https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103373
Bug ID: 103373 Summary: ICE in add_constraint, at cp/constraint.cc:1077 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- g++-12.0.0-alpha20211121 snapshot (g:da17c304e22ba256eba0b03710aa329115163b08) ICEs when compiling the following testcase, reduced from test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp from the clang 13.0.0 test suite, w/ -std=c++20: template<typename T> concept True = true; template<typename T> concept True2 = sizeof(T) >= 0; template<typename T> concept Foo2 = True2<T*>; template<typename T> concept Bar2 = Foo2<T&>; namespace type_pack { template<typename... Args> concept C1 = ((sizeof(Args) >= 0) && ...); template<typename A, typename... B> concept C2 = C1<A, B...>; template<typename T> constexpr void foo() requires C2<T, char, T> { } template<typename T> constexpr void foo() requires C1<T, char, T> && true { } static_assert((foo<int>(), true)); } namespace PR47174 { template <Bar2 T, True U> requires true struct S3; template <True T, True U> requires true struct S3<T, U>; } % g++-12.0.0 -std=c++20 -c cmqenks0.cpp cmqenks0.cpp:27:22: error: forming pointer to reference type 'T&' 27 | requires true struct S3<T, U>; | ^~~~~~~~ cmqenks0.cpp:27:22: internal compiler error: in add_constraint, at cp/constraint.cc:1077 0x67e3d6 add_constraint /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/constraint.cc:1077 0x988ab2 add_constraint /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/constraint.cc:1070 0x988ab2 add_constraint /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/constraint.cc:1070 0x988b67 iterative_hash_constraint(tree_node*, unsigned int) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/constraint.cc:1090 0xa2e2a1 subsumption_hasher::hash(subsumption_entry*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/logic.cc:737 0xa2e2a1 hash_table<subsumption_hasher, false, xcallocator>::find(subsumption_entry* const&) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/hash-table.h:430 0xa2e2a1 lookup_subsumption /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/logic.cc:763 0xa2e2a1 subsumes_constraints_nonnull /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/logic.cc:795 0xa2e2a1 subsumes(tree_node*, tree_node*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/logic.cc:842 0x98cc7d strictly_subsumes(tree_node*, tree_node*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/constraint.cc:3488 0xb3e4db process_partial_specialization /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/pt.c:5131 0xb41265 push_template_decl(tree_node*, bool) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/pt.c:5711 0xb41265 maybe_process_partial_specialization(tree_node*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/pt.c:1042 0x9e0ae0 shadow_tag(cp_decl_specifier_seq*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/decl.c:5409 0xae7883 cp_parser_single_declaration /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:31538 0xae7ba5 cp_parser_template_declaration_after_parameters /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:31162 0xae8450 cp_parser_explicit_template_declaration /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:31428 0xaeaf21 cp_parser_declaration /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:14786 0xaea4f9 cp_parser_toplevel_declaration /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:14876 0xaea4f9 cp_parser_declaration_seq_opt /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211121/work/gcc-12-20211121/gcc/cp/parser.c:14629