http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60222

            Bug ID: 60222
           Summary: [4.8/4.9 Regression] ICE with reference as template
                    parameter
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
                CC: jason at gcc dot gnu.org

The following valid code snippet triggers an ICE on the 4.8 branch and trunk:

==========================================
template<int&> struct A
{
  template<typename> struct B;

  template<typename T> struct B<T*> {};
};
==========================================

bug.cc:5:35: 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:7674
   template<typename T> struct B<T*> {};
                                   ^
0xdbfcc4 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9192
0x5bc4b9 tree_check3(tree_node*, char const*, int, char const*, tree_code,
tree_code, tree_code)
        ../../gcc/gcc/tree.h:2749
0x6251fc lookup_template_class_1
        ../../gcc/gcc/cp/pt.c:7674
0x6251fc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/gcc/cp/pt.c:7725
0x72dcb2 finish_template_type(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/semantics.c:2953
0x6c2068 cp_parser_template_id
        ../../gcc/gcc/cp/parser.c:13440
0x6c2388 cp_parser_class_name
        ../../gcc/gcc/cp/parser.c:19074
0x6b3bb9 cp_parser_qualifying_entity
        ../../gcc/gcc/cp/parser.c:5524
0x6b3bb9 cp_parser_nested_name_specifier_opt
        ../../gcc/gcc/cp/parser.c:5249
0x6aa243 cp_parser_class_head
        ../../gcc/gcc/cp/parser.c:19529
0x6aa243 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:19155
0x6aa243 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19437
0x6aa243 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14302
0x6c2ba0 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11547
0x6c8883 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:23039
0x6c8d64 cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:22915
0x6a5f36 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:20049
0x6a9724 cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:19976
0x6a9724 cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:19210
0x6a9724 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19437
Please submit a full bug report, [etc.]

The example compiles fine with GCC 4.8.0 - 4.8.2.

The regression might be fallout from the fix for PR58606.
Jason, would you mind having a look?

Reply via email to