[Bug c++/71821] New: ICE on invalid C++11 code (incorrect argument for alignas): unexpected expression ‘f<int>’ of kind template_id_expr
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Sat Jul 9 04:53:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71821
Bug ID: 71821
Summary: ICE on invalid C++11 code (incorrect argument for
alignas): unexpected expression ‘f<int>’ of kind
template_id_expr
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following C++11 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.
It affects all versions since 4.8.x, and is rejected by 4.7.x and before (as
alignas wasn't yet unsupported).
$ 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.0/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.0 20160707 (experimental) [trunk revision 238117] (GCC)
$
$ g++-trunk -c small.cpp
small.cpp:4:10: internal compiler error: unexpected expression ‘f<int>’ of kind
template_id_expr
alignas (f < int >) char c;
^~~~~~~~~
0x8acd4c cxx_eval_constant_expression
../../gcc-source-trunk/gcc/cp/constexpr.c:4153
0x8b1ca9 cxx_eval_outermost_constant_expr
../../gcc-source-trunk/gcc/cp/constexpr.c:4211
0x79f4cd cp_parser_std_attribute_spec
../../gcc-source-trunk/gcc/cp/parser.c:24164
0x79f4cd cp_parser_std_attribute_spec_seq
../../gcc-source-trunk/gcc/cp/parser.c:24204
0x7a450f cp_parser_decl_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:12575
0x7adc01 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12304
0x7ae051 cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12251
0x7b6cc0 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12148
0x7b5794 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12027
0x7b5ac8 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4329
0x7b5ac8 c_parse_file()
../../gcc-source-trunk/gcc/cp/parser.c:37505
0x919b92 c_common_parse_file()
../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
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 4; }
// should be: alignas (f < int >()) char c;
alignas (f < int >) char c;
More information about the Gcc-bugs
mailing list