https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69481

            Bug ID: 69481
           Summary: ICE with C++11 alias using with templates
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
   template <class V> struct tt{
     using ut = tt<V>;
     ut& operator++();
};
template <class V> tt<V>& tt<V>::operator++() {}

---- CUT ----
This causes an ICE with the trunk and GCC 5.3:
t.cc:5:48: internal compiler error: same canonical type node for different
types tt<V> and tt<V>::ut
    template <class V> tt<V>& tt<V>::operator++() {}
                                                ^

0x725dcb comptypes(tree_node*, tree_node*, int)
        /home/apinski/src/local/gcc/gcc/cp/typeck.c:1435
0x724503 structural_comptypes
        /home/apinski/src/local/gcc/gcc/cp/typeck.c:1357
0x725d23 comptypes(tree_node*, tree_node*, int)
        /home/apinski/src/local/gcc/gcc/cp/typeck.c:1420
0x6ac31f check_classfn(tree_node*, tree_node*, tree_node*)
        /home/apinski/src/local/gcc/gcc/cp/decl2.c:726
0x57fa9f grokfndecl
        /home/apinski/src/local/gcc/gcc/cp/decl.c:8176
0x600277 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/apinski/src/local/gcc/gcc/cp/decl.c:11332
0x6033db start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
        /home/apinski/src/local/gcc/gcc/cp/decl.c:14136
0x70b5e3 cp_parser_function_definition_from_specifiers_and_declarator
        /home/apinski/src/local/gcc/gcc/cp/parser.c:25133
...

So far I tracked down the main difference between C++11 alias and typedef in
this case is TYPE_ALIAS_P being check somewhere to cause a different type being
created.

Reply via email to