https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79380
Bug ID: 79380 Summary: ICE on C++11 code with illegal alignas specifier on x86_64-linux-gnu: unexpected expression ‘f’ of kind overload Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- It seems to affect all versions 4.8.x and later. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.1 20170204 (experimental) [trunk revision 245182] (GCC) $ $ g++-trunk -std=c++11 -c small.cpp small.cpp:4:17: internal compiler error: unexpected expression ‘f’ of kind overload struct alignas (f) S {}; ^ 0x8d4f9e cxx_eval_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:4533 0x8da649 cxx_eval_outermost_constant_expr ../../gcc-source-trunk/gcc/cp/constexpr.c:4591 0x7c05bb cp_parser_std_attribute_spec ../../gcc-source-trunk/gcc/cp/parser.c:24962 0x7c05bb cp_parser_std_attribute_spec_seq ../../gcc-source-trunk/gcc/cp/parser.c:25002 0x7aa6f5 cp_parser_class_head ../../gcc-source-trunk/gcc/cp/parser.c:22414 0x7aa6f5 cp_parser_class_specifier_1 ../../gcc-source-trunk/gcc/cp/parser.c:22032 0x7ac3d9 cp_parser_class_specifier ../../gcc-source-trunk/gcc/cp/parser.c:22344 0x7ac3d9 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:16408 0x7c40f3 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:13325 0x7ce2a0 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12649 0x7cf161 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12594 0x7d5f30 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12491 0x7d6334 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12367 0x7d6678 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4366 0x7d6678 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:38382 0x93e552 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1107 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 < typename > constexpr int f () { return 8; } // should have been: struct alignas (f<int>()) S {}; struct alignas (f) S {};