Created attachment 48729 [details] testcase With current master (06712fc68dc9843d9af7c7ac10047f49d305ad76), running g++ -S test.ii -std=c++20 In the attached file causes test.ii:511:41: internal compiler error: in build_over_call, at cp/call.c:8971 g++ 9 has no problems with it.
Sorry, gcc *10* has no problem with it.
With -std=c++2a -fconcepts it started with r9-6542-gf869f40780836d17. It was rejected before that.
Here's a reduced testcase that ICEs when compiled with -std=c++17 since r7-3599 (when GCC is configured with --enable-checking=yes): $ cat 95675.C struct a {}; template <typename> struct b; template <typename bq, typename br> struct b<bq(br)> { decltype(bq()(br())) c; }; struct e { operator a(); }; b<e (*(e))(a)> d; $ g++ -std=c++17 95675.C 95675.C: In instantiation of ‘struct b<e (*(e))(a)>’: 95675.C:9:16: required from here 95675.C:4:16: internal compiler error: in build_over_call, at cp/call.c:8945 4 | decltype(bq()(br())) c; | ~~~~^~~~~~
Here's a non-template testcase that ICEs from the same assert in build_over_call (with -std=c++17, --enable-checking=yes): struct b {}; b operator|(b, b) { return {}; } b e, f, g; using h = decltype(e | f | g);
*** Bug 96576 has been marked as a duplicate of this bug. ***
Comment 4 test started with r240845.
*** Bug 99016 has been marked as a duplicate of this bug. ***
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:74aee6d20872e8d87558eb5bf601042e3ed3fb2a commit r11-7481-g74aee6d20872e8d87558eb5bf601042e3ed3fb2a Author: Jason Merrill <jason@redhat.com> Date: Tue Mar 2 23:59:00 2021 -0500 c++: C++17 and decltype of multi-operator expression [PR95675] A call that is the immediate operand of decltype has special semantics: no temporary is produced, so it's OK for the return type to be e.g. incomplete. But we were treating (e | f) the same way, which confused overload resolution when we then tried to evaluate ... | g. Fixed by making build_temp do what its name says, and force the C++17 temporary materialization conversion. gcc/cp/ChangeLog: PR c++/95675 * call.c (build_temp): Wrap a CALL_EXPR in a TARGET_EXPR if it didn't get one before. gcc/testsuite/ChangeLog: PR c++/95675 * g++.dg/cpp0x/decltype-call5.C: New test. * g++.dg/cpp0x/decltype-call6.C: New test.
The releases/gcc-10 branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:371c7a82833df5d84392838cf2bf95b4da88655c commit r10-9414-g371c7a82833df5d84392838cf2bf95b4da88655c Author: Jason Merrill <jason@redhat.com> Date: Tue Mar 2 23:59:00 2021 -0500 c++: C++17 and decltype of multi-operator expression [PR95675] A call that is the immediate operand of decltype has special semantics: no temporary is produced, so it's OK for the return type to be e.g. incomplete. But we were treating (e | f) the same way, which confused overload resolution when we then tried to evaluate ... | g. Fixed by making build_temp do what its name says, and force the C++17 temporary materialization conversion. gcc/cp/ChangeLog: PR c++/95675 * call.c (build_temp): Wrap a CALL_EXPR in a TARGET_EXPR if it didn't get one before. gcc/testsuite/ChangeLog: PR c++/95675 * g++.dg/cpp0x/decltype-call5.C: New test. * g++.dg/cpp0x/decltype-call6.C: New test.
The releases/gcc-9 branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:e90b052caf74dcc7529e6b2cc0b0688eebf53c74 commit r9-9264-ge90b052caf74dcc7529e6b2cc0b0688eebf53c74 Author: Jason Merrill <jason@redhat.com> Date: Tue Mar 2 23:59:00 2021 -0500 c++: C++17 and decltype of multi-operator expression [PR95675] A call that is the immediate operand of decltype has special semantics: no temporary is produced, so it's OK for the return type to be e.g. incomplete. But we were treating (e | f) the same way, which confused overload resolution when we then tried to evaluate ... | g. Fixed by making build_temp do what its name says, and force the C++17 temporary materialization conversion. gcc/cp/ChangeLog: PR c++/95675 * call.c (build_temp): Wrap a CALL_EXPR in a TARGET_EXPR if it didn't get one before. gcc/testsuite/ChangeLog: PR c++/95675 * g++.dg/cpp0x/decltype-call5.C: New test. * g++.dg/cpp0x/decltype-call6.C: New test.
Fixed for 9.4/10.3/11.
*** Bug 97962 has been marked as a duplicate of this bug. ***