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

            Bug ID: 85062
           Summary: [6/7/8 Regression] ICE on alignas with parameter pack
           Product: gcc
           Version: 8.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
  Target Milestone: ---

The following valid code snippet triggers an ICE since GCC 5.2.0:

====================================
template<typename... T> struct A
{
  int alignas(T...) i;
};

A<int> a;
====================================

bug.cc:3:7: internal compiler error: tree check: expected tree that contains
'common' structure, have 'expr_pack_expansion' in list_length, at tree.c:2973
   int alignas(T...) i;
       ^~~~~~~
0x78cd61 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9494
0x78d0ca contains_struct_check(tree_node const*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc/gcc/tree.h:3505
0x78d0ca list_length(tree_node const*)
        ../../gcc/gcc/tree.c:2973
0x9fc35a decl_attributes(tree_node**, tree_node*, int, tree_node*)
        ../../gcc/gcc/attribs.c:573
0x8a4c25 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/gcc/cp/decl.c:10951
0x8b5db8 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:829
0x92d9e2 cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:23918
0x92ea8a cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:23397
0x92ea8a cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:22529
0x930b89 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:22791
0x930b89 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:16776
0x93dec6 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:13627
0x942635 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:27213
0x9429bc cp_parser_template_declaration_after_parameters
        ../../gcc/gcc/cp/parser.c:26905
0x94327c cp_parser_explicit_template_declaration
        ../../gcc/gcc/cp/parser.c:27142
0x94327c cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:27161
0x9485e9 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12731
0x9488d1 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12658
0x948bc4 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4563
0x948bc4 c_parse_file()
        ../../gcc/gcc/cp/parser.c:39024
Please submit a full bug report, [etc.]


In case of a non-variadic template the code is accepted with a warning
(which is why IMHO the code above should be accepted, too):

bug.cc:3:7: warning: attribute ignored [-Wattributes]
   int alignas(T) i;
       ^~~~~~~
bug.cc:3:7: note: an attribute that appertains to a type-specifier is ignored

Reply via email to