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

            Bug ID: 84540
           Summary: [6/7/8 Regression] ICE with alignas in variadic
                    template
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-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 6.1.0,
while it was accepted in GCC 5.2.0 - 5.4.0:

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

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

bug.cc: In instantiation of 'struct A<>':
bug.cc:3:5:   required from here
bug.cc:1:55: internal compiler error: Segmentation fault
 template<typename... T> struct alignas(alignof(T)...) A {};
                                                       ^
0xeb1cef crash_signal
        ../../gcc/gcc/toplev.c:325
0x97866d contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc/gcc/tree.h:3245
0x97866d apply_late_template_attributes
        ../../gcc/gcc/cp/pt.c:10318
0x989727 instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:10550
0x989727 instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:10930
0x9ce93d complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:136
0x87f5b7 start_decl_1(tree_node*, bool)
        ../../gcc/gcc/cp/decl.c:5201
0x8a52ff start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:5164
0x934a89 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19578
0x93c1c8 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13044
0x93cfd8 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12869
0x940f32 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12767
0x941341 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12643
0x941634 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4559
0x941634 c_parse_file()
        ../../gcc/gcc/cp/parser.c:38866
0xa3f966 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

Btw, clang 6.0.0rc2 accepts the code.

Reply via email to