All g++ branches from 6 to the current master (10.0.1-alpha20200405 snapshot, g:2a1a0c8c0db0aae50a2cebce59bd64334cd6ba2a) ICE when compiling the following testcase, extracted from test/SemaTemplate/instantiate-requires-clause.cpp from the clang 10.0.0 test suite, w/ -fconcepts: template<typename T> struct S4 { void foo() requires (*this) { } }; static_assert((S4<int>{}.foo(), true)); % g++-10.0.1 -fconcepts -c cxbvanvw.cpp cxbvanvw.cpp: In instantiation of 'void S4<T>::foo() requires *(S4<T>*)this [with T = int]': cxbvanvw.cpp:6:30: required from here cxbvanvw.cpp:3:25: internal compiler error: in tsubst_copy, at cp/pt.c:16186 3 | void foo() requires (*this) { } | ^~~~ 0x65dc87 tsubst_copy /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/pt.c:16186 0x9f9990 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/pt.c:20244 0x9f9be8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/pt.c:19121 0x9fb247 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/pt.c:19099 0x9eb259 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/pt.c:18613 0x8b96c2 satisfy_constraint_r /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/constraint.cc:2595 0x8b9ab8 satisfy_constraint /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/constraint.cc:2677 0x8ba9d8 constraint_satisfaction_value /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/constraint.cc:2695 0x8babaa constraints_satisfied_p(tree_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/constraint.cc:2846 0x86e8f1 add_function_candidate /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/call.c:2288 0x86ff1c add_candidates /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/call.c:5854 0x876ec3 add_candidates /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/call.c:5756 0x876ec3 build_new_method_call_1 /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/call.c:10204 0x8781bf build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/call.c:10413 0x9aa259 cp_parser_postfix_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:7430 0x98b7e9 cp_parser_binary_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:9554 0x98d49e cp_parser_assignment_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:9859 0x98d863 cp_parser_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:10027 0x99e1bb cp_parser_primary_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:5359 0x9a9607 cp_parser_postfix_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200405/work/gcc-10-20200405/gcc/cp/parser.c:7257
Confirmed, -fconcepts started with GCC 6. Is it a valid or invalid code?
(In reply to Martin Liška from comment #1) > Confirmed, -fconcepts started with GCC 6. Is it a valid or invalid code? clang rejects it, but accepts the following one, on which g++ also ICEs: template<typename T> struct S4 { void foo() requires (this, true) { } }; void bar () { S4<int>{}.foo (); }
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:4e1aaf32ddf13cc79fcf146d6b62a6e0feb82be0 commit r12-73-g4e1aaf32ddf13cc79fcf146d6b62a6e0feb82be0 Author: Patrick Palka <ppalka@redhat.com> Date: Thu Apr 22 17:47:02 2021 -0400 c++: Add testcase for already fixed PR [PR94508] We correctly accept this testcase since r11-8144. gcc/testsuite/ChangeLog: PR c++/94508 * g++.dg/cpp2a/concepts-uneval3.C: New test.
Already fixed for GCC 11.