This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71738] New: ICE on valid C++ code: tree check: expected record_type or union_type or qual_union_type, have template_decl in lookup_template_class_1, at cp/pt.c:8619


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

            Bug ID: 71738
           Summary: ICE on valid C++ code: tree check: expected
                    record_type or union_type or qual_union_type, have
                    template_decl in lookup_template_class_1, at
                    cp/pt.c:8619
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following C++ code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

It seems to affect all versions since at least as early as 4.6.x. 


$ g++-trunk -c small.cpp
small.cpp: In instantiation of âstruct S<int>â:
small.cpp:14:11:   required from here
small.cpp:11:15: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have template_decl in lookup_template_class_1,
at cp/pt.c:8619
   friend void A < X >::B < Y >::operator= (Z);
               ^~~~~~~
0x105eccc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc-source-trunk/gcc/tree.c:9751
0x67f4c9 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
        ../../gcc-source-trunk/gcc/tree.h:3070
0x700615 lookup_template_class_1
        ../../gcc-source-trunk/gcc/cp/pt.c:8619
0x700615 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc-source-trunk/gcc/cp/pt.c:8672
0x70106b tsubst_aggr_type
        ../../gcc-source-trunk/gcc/cp/pt.c:11482
0x6f29fc tsubst_decl
        ../../gcc-source-trunk/gcc/cp/pt.c:11847
0x6ea75e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:12874
0x6f166e tsubst_decl
        ../../gcc-source-trunk/gcc/cp/pt.c:11708
0x6ea75e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:12874
0x71df81 tsubst_friend_function
        ../../gcc-source-trunk/gcc/cp/pt.c:9257
0x71df81 instantiate_class_template_1
        ../../gcc-source-trunk/gcc/cp/pt.c:10318
0x71df81 instantiate_class_template(tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:10417
0x7c09a3 complete_type(tree_node*)
        ../../gcc-source-trunk/gcc/cp/typeck.c:133
0x685ee8 start_decl_1(tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/decl.c:5084
0x6acead start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc-source-trunk/gcc/cp/decl.c:5047
0x7ad262 cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:18571
0x7addb9 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12383
0x7ae0c1 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12251
0x7b6d30 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12148
0x7b5804 cp_parser_declaration_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:12027
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.
$


--------------------------------------------------


template < class > struct S
{ 
  template < class > struct A
  { 
    template < class > struct B;
  };

  template < class X >
  template < class Y >
  template < class Z >
  friend void A < X >::B < Y >::operator= (Z);
};

S < int > s;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]