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.
Confirmed. Bisection points to r232701: r232701 | jason | 2016-01-21 15:26:02 -0500 (Thu, 21 Jan 2016) | 5 lines PR c++/43407 * decl.c (start_enum): Add attributes parameter. * parser.c (cp_parser_enum_specifier): Pass it. * pt.c (lookup_template_class_1): Pass it. * cp-tree.h: Adjust.
This is valid, and doesn't seem hard to fix.
Author: paolo Date: Mon Feb 26 20:06:40 2018 New Revision: 258012 URL: https://gcc.gnu.org/viewcvs?rev=258012&root=gcc&view=rev Log: /cp 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84540 * pt.c (tsubst_attributes): Handle correctly tsubst_attribute returning NULL_TREE. (apply_late_template_attributes): Likewise. /testsuite 2018-02-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84540 * g++.dg/cpp0x/alignas14.C: New. * g++.dg/cpp0x/alignas15.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/cpp0x/alignas14.C trunk/gcc/testsuite/g++.dg/cpp0x/alignas15.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed in trunk so far.
GCC 6 branch is being closed
Fixed in GCC 8.