https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89766
Bug ID: 89766 Summary: ICE: canonical types differ for identical types, -std=c++17 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rimvydas.jas at gmail dot com Target Milestone: --- Using gcc-8 branch c++17 three different(?) ICEs with -fchecking while compiling boost: $ /opt/gcc8/bin/g++ --version # on DragonFlyBSD g++ (GCC) 8.3.1 20190318 [gcc-8-branch revision 5d34f779cb1:731cdfacfef:2f978d6d097b6ad2a2fdff05d1f20a86ab674ceb] from libs/contract/src/contract.cpp:11: ./boost/function/function_template.hpp:523:9: internal compiler error: canonical types differ for identical types 'F' and 'FunctionPtr' Reduced testcase: $ cat creduce_contract.ii template <template <class> class a> struct b { template <class> static int c; decltype(c<a>); }; template <typename> struct d { template <typename a, typename> bool e() const; template <typename, typename> bool e() const; } /opt/gcc8/bin/g++ -std=c++17 -c creduce_contract.ii creduce_contract.ii:7:47: internal compiler error: canonical types differ for identical types 'a' and '<template-parameter-2-1>' template <typename, typename> bool e() const; ^ 0x9c13e8 comptypes(tree_node*, tree_node*, int) /zzz/gcc/gcc_git/gcc/cp/typeck.c:1480 0x933082 comp_template_parms(tree_node const*, tree_node const*) /zzz/gcc/gcc_git/gcc/cp/pt.c:3302 0x823f67 add_method(tree_node*, tree_node*, bool) /zzz/gcc/gcc_git/gcc/cp/class.c:1062 0x99276e finish_member_declaration(tree_node*) /zzz/gcc/gcc_git/gcc/cp/semantics.c:3114 0x929c87 cp_parser_template_declaration_after_parameters /zzz/gcc/gcc_git/gcc/cp/parser.c:27077 0x92a4bc cp_parser_explicit_template_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:27236 0x92a4bc cp_parser_template_declaration_after_export /zzz/gcc/gcc_git/gcc/cp/parser.c:27255 0x914fed cp_parser_member_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:23552 0x915eda cp_parser_member_specification_opt ... from libs/log/src/severity_level.cpp:18: ./boost/parameter/aux_/tagged_argument.hpp:132:5: internal compiler error: canonical types differ for identical types 'Default' and 'F' Reduced testcase: $ cat creduce_severity_level.ii template <typename, template <typename> class> struct a; template <template <typename> class b> struct a<int, b>; template <class> struct c { template <class> int operator[](int) const; template <class b> int operator[](int) const; }; /opt/gcc8/bin/g++ -std=c++17 -c creduce_severity_level.ii creduce_severity_level.ii:5:47: internal compiler error: canonical types differ for identical types '<template-parameter-2-1>' and 'b' template <class b> int operator[](int) const; ^ 0x9c13e8 comptypes(tree_node*, tree_node*, int) /zzz/gcc/gcc_git/gcc/cp/typeck.c:1480 0x933082 comp_template_parms(tree_node const*, tree_node const*) /zzz/gcc/gcc_git/gcc/cp/pt.c:3302 0x823f67 add_method(tree_node*, tree_node*, bool) /zzz/gcc/gcc_git/gcc/cp/class.c:1062 0x99276e finish_member_declaration(tree_node*) /zzz/gcc/gcc_git/gcc/cp/semantics.c:3114 0x929c87 cp_parser_template_declaration_after_parameters /zzz/gcc/gcc_git/gcc/cp/parser.c:27077 0x92a4bc cp_parser_explicit_template_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:27236 0x92a4bc cp_parser_template_declaration_after_export /zzz/gcc/gcc_git/gcc/cp/parser.c:27255 0x914fed cp_parser_member_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:23552 0x915eda cp_parser_member_specification_opt ... from libs/log/src/setup/default_filter_factory.cpp:22: ./boost/spirit/home/support/action_dispatch.hpp:180:9: internal compiler error: canonical types differ for identical types 'F' and 'Eval' Reduced testcase: $ cat creduce_default_filter_factory.ii template <typename, template <typename, typename> class> struct a; template <template <typename, typename> class b> struct a<int, b>; template <typename> struct c { template <typename b, typename, typename> bool operator()(); template <typename, typename, typename> bool operator()(); }; $ /opt/gcc8/bin/g++ -std=c++17 -c creduce_default_filter_factory.ii creduce_default_filter_factory.ii:5:60: internal compiler error: canonical types differ for identical types 'b' and '<template-parameter-2-1>' template <typename, typename, typename> bool operator()(); ^ 0x9c13e8 comptypes(tree_node*, tree_node*, int) /zzz/gcc/gcc_git/gcc/cp/typeck.c:1480 0x933082 comp_template_parms(tree_node const*, tree_node const*) /zzz/gcc/gcc_git/gcc/cp/pt.c:3302 0x823f67 add_method(tree_node*, tree_node*, bool) /zzz/gcc/gcc_git/gcc/cp/class.c:1062 0x99276e finish_member_declaration(tree_node*) /zzz/gcc/gcc_git/gcc/cp/semantics.c:3114 0x929c87 cp_parser_template_declaration_after_parameters /zzz/gcc/gcc_git/gcc/cp/parser.c:27077 0x92a4bc cp_parser_explicit_template_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:27236 0x92a4bc cp_parser_template_declaration_after_export /zzz/gcc/gcc_git/gcc/cp/parser.c:27255 0x914fed cp_parser_member_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:23552 0x915eda cp_parser_member_specification_opt /zzz/gcc/gcc_git/gcc/cp/parser.c:23479 0x915eda cp_parser_class_specifier_1 /zzz/gcc/gcc_git/gcc/cp/parser.c:22610 0x917f39 cp_parser_class_specifier /zzz/gcc/gcc_git/gcc/cp/parser.c:22872 0x917f39 cp_parser_type_specifier /zzz/gcc/gcc_git/gcc/cp/parser.c:16788 0x925256 cp_parser_decl_specifier_seq /zzz/gcc/gcc_git/gcc/cp/parser.c:13626 0x929895 cp_parser_single_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:27307 0x929c0c cp_parser_template_declaration_after_parameters /zzz/gcc/gcc_git/gcc/cp/parser.c:26999 0x92a4bc cp_parser_explicit_template_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:27236 0x92a4bc cp_parser_template_declaration_after_export /zzz/gcc/gcc_git/gcc/cp/parser.c:27255 0x92f8ba cp_parser_declaration /zzz/gcc/gcc_git/gcc/cp/parser.c:12724 0x92fb8a cp_parser_declaration_seq_opt /zzz/gcc/gcc_git/gcc/cp/parser.c:12651 0x92fe5c cp_parser_translation_unit /zzz/gcc/gcc_git/gcc/cp/parser.c:4563 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.