https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67019
Bug ID: 67019 Summary: [c++-concepts] ICE: canonical types differ for identical types Product: gcc Version: c++-concepts Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- Created attachment 36060 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36060&action=edit Test case Attached program: template <bool...> struct bool_sequence {}; template <class T, class...Us> concept bool Same = __is_same_as(bool_sequence<__is_same_as(T, Us)...>, bool_sequence<(true || __is_same_as(T, Us))...>); template <class I> concept bool A = requires (I& i) { requires Same<I&, decltype(++i)>; }; template <class I> concept bool B = A<I> && true; template <A> constexpr bool f() { return false; } template <B> constexpr bool f() { return true; } int main() { static_assert(f<int>()); } ICEs with: ~/concept-gcc/bin/g++ -std=gnu++1z foo2.cpp -c foo2.cpp: In function ‘int main()’: foo2.cpp:23:24: internal compiler error: canonical types differ for identical types bool_sequence<__is_same_as(I&, decltype(++*i))> and bool_sequence<__is_same_as(I&, decltype(++*i))> static_assert(f<int>()); ^ 0x72548e comptypes(tree_node*, tree_node*, int) ../../gcc/cp/typeck.c:1416 0x798fc9 cp_tree_equal(tree_node*, tree_node*) ../../gcc/cp/tree.c:3075 0x799bf5 cp_tree_equal(tree_node*, tree_node*) ../../gcc/cp/tree.c:3122 0x8077d4 match_terms ../../gcc/cp/logic.cc:383 0x8077d4 subsumes_atomic_constraint ../../gcc/cp/logic.cc:393 0x8077d4 subsumes_constraint ../../gcc/cp/logic.cc:444 0x80795e subsumes_conjunction ../../gcc/cp/logic.cc:405 0x80795e subsumes_constraint ../../gcc/cp/logic.cc:438 0x807b08 subsumes_constraints_nonnull ../../gcc/cp/logic.cc:462 0x807b08 subsumes(tree_node*, tree_node*) ../../gcc/cp/logic.cc:480 0x6725d1 more_specialized_fn(tree_node*, tree_node*, int) ../../gcc/cp/pt.c:19729 0x5dff09 joust ../../gcc/cp/call.c:9151 0x5e12b3 joust ../../gcc/cp/call.c:8944 0x5e12b3 tourney ../../gcc/cp/call.c:9348 0x5e877a perform_overload_resolution ../../gcc/cp/call.c:4009 0x5eac8e build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int) ../../gcc/cp/call.c:4082 0x773220 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/cp/semantics.c:2391 0x6f2209 cp_parser_postfix_expression ../../gcc/cp/parser.c:6410 0x6f6ab9 cp_parser_unary_expression ../../gcc/cp/parser.c:7477 0x6f76e7 cp_parser_binary_expression ../../gcc/cp/parser.c:8214 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.