public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken @ 2023-09-20 7:38 elrodc at gmail dot com 2023-09-20 12:45 ` [Bug c++/111493] " ppalka at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: elrodc at gmail dot com @ 2023-09-20 7:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 Bug ID: 111493 Summary: [concepts] multidimensional subscript operator inside requires is broken Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: elrodc at gmail dot com Target Milestone: --- Two example programs: > #include <concepts> > constexpr auto foo(const auto &A, int i, int j) requires(requires(decltype(A) a, int ii) { a[ii, ii]; }) { > return A[i, j]; > } > constexpr auto foo(const auto &A, int i, int j) { > return A + i + j; > } > static_assert(foo(2,3,4) == 9); > #include <concepts> > template <typename T, typename S> > concept CartesianIndexable = requires(T t, int i) { > { t[i, i] } -> std::convertible_to<S>; > }; > static_assert(!CartesianIndexable<double,int>); These result in errors of the form error: invalid types 'const int[int]' for array subscript Here is godbolt for reference: https://godbolt.org/z/WE66nY8zG The invalid subscript should result in the `requires` failing, not an error. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com @ 2023-09-20 12:45 ` ppalka at gcc dot gnu.org 2023-09-20 17:50 ` elrodc at gmail dot com ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: ppalka at gcc dot gnu.org @ 2023-09-20 12:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 CC| |ppalka at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2023-09-20 --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- Confirmed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com 2023-09-20 12:45 ` [Bug c++/111493] " ppalka at gcc dot gnu.org @ 2023-09-20 17:50 ` elrodc at gmail dot com 2023-09-22 10:31 ` cvs-commit at gcc dot gnu.org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: elrodc at gmail dot com @ 2023-09-20 17:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 --- Comment #2 from Chris Elrod <elrodc at gmail dot com> --- Note that it also shows up in gcc-13. I put gcc-14 as the version to indicate that I confirmed it is still a problem on latest trunk. Not sure what the policy is on which version we should report. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com 2023-09-20 12:45 ` [Bug c++/111493] " ppalka at gcc dot gnu.org 2023-09-20 17:50 ` elrodc at gmail dot com @ 2023-09-22 10:31 ` cvs-commit at gcc dot gnu.org 2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-09-22 10:31 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:1fea14def849dd38b098b0e2d54e64801f9c1f43 commit r14-4225-g1fea14def849dd38b098b0e2d54e64801f9c1f43 Author: Patrick Palka <ppalka@redhat.com> Date: Fri Sep 22 06:27:48 2023 -0400 c++: missing SFINAE in grok_array_decl [PR111493] We should guard both the diagnostic and backward compatibilty fallback code with tf_error, so that in a SFINAE context we don't issue any diagnostics and correctly treat ill-formed C++23 multidimensional subscript operator expressions as such. PR c++/111493 gcc/cp/ChangeLog: * decl2.cc (grok_array_decl): Guard diagnostic and backward compatibility fallback code paths with tf_error. gcc/testsuite/ChangeLog: * g++.dg/cpp23/subscript15.C: New test. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com ` (2 preceding siblings ...) 2023-09-22 10:31 ` cvs-commit at gcc dot gnu.org @ 2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-09-24 18:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:40d2dec34b58c3c31b1c731049a914204ec252c3 commit r13-7837-g40d2dec34b58c3c31b1c731049a914204ec252c3 Author: Patrick Palka <ppalka@redhat.com> Date: Fri Sep 22 06:27:48 2023 -0400 c++: missing SFINAE in grok_array_decl [PR111493] We should guard both the diagnostic and backward compatibilty fallback code with tf_error, so that in a SFINAE context we don't issue any diagnostics and correctly treat ill-formed C++23 multidimensional subscript operator expressions as such. PR c++/111493 gcc/cp/ChangeLog: * decl2.cc (grok_array_decl): Guard diagnostic and backward compatibility fallback code paths with tf_error. gcc/testsuite/ChangeLog: * g++.dg/cpp23/subscript15.C: New test. (cherry picked from commit 1fea14def849dd38b098b0e2d54e64801f9c1f43) ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com ` (3 preceding siblings ...) 2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org @ 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: ppalka at gcc dot gnu.org @ 2023-09-24 18:52 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> --- Fixed for GCC 13.3 / 14, thanks for the bug report. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/111493] [concepts] multidimensional subscript operator inside requires is broken 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com ` (4 preceding siblings ...) 2023-09-24 18:52 ` ppalka at gcc dot gnu.org @ 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: ppalka at gcc dot gnu.org @ 2023-09-24 18:52 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111493 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ldalessandro at gmail dot com --- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- *** Bug 108736 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-24 18:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-09-20 7:38 [Bug c++/111493] New: [concepts] multidimensional subscript operator inside requires is broken elrodc at gmail dot com 2023-09-20 12:45 ` [Bug c++/111493] " ppalka at gcc dot gnu.org 2023-09-20 17:50 ` elrodc at gmail dot com 2023-09-22 10:31 ` cvs-commit at gcc dot gnu.org 2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org 2023-09-24 18:52 ` ppalka at gcc dot gnu.org 2023-09-24 18:52 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).