https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71665
Zhendong Su <su at cs dot ucdavis.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|ICE on invalid C++ code |ICE on invalid C++ code |with non-integral constant |with non-integral constant |enumerator value: |enumerator value: in | |cxx_eval_constant_expressio | |n, at cp/constexpr.c:3918 --- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> --- The following C++ code causes an ICE when compiled with the current GCC trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 6.1.x. $ 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 20160625 (experimental) [trunk revision 237780] (GCC) $ $ g++-6.1 -c small.cpp small.cpp:4:14: error: enumerator value for ‘a’ is not an integer constant enum { a = f }; ^ $ $ g++-trunk -c small.cpp small.cpp:4:14: internal compiler error: in cxx_eval_constant_expression, at cp/constexpr.c:3918 enum { a = f }; ^ 0x8acaed cxx_eval_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:3918 0x8b1929 cxx_eval_outermost_constant_expr ../../gcc-source-trunk/gcc/cp/constexpr.c:4211 0x6a22c7 build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*, unsigned int) ../../gcc-source-trunk/gcc/cp/decl.c:13588 0x7a98e2 cp_parser_enumerator_definition ../../gcc-source-trunk/gcc/cp/parser.c:17431 0x7a98e2 cp_parser_enumerator_list ../../gcc-source-trunk/gcc/cp/parser.c:17360 0x7a98e2 cp_parser_enum_specifier ../../gcc-source-trunk/gcc/cp/parser.c:17287 0x78aea9 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:15813 0x79fc23 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12763 0x7af2ed cp_parser_member_declaration ../../gcc-source-trunk/gcc/cp/parser.c:22334 0x78b118 cp_parser_member_specification_opt ../../gcc-source-trunk/gcc/cp/parser.c:22186 0x78b118 cp_parser_class_specifier_1 ../../gcc-source-trunk/gcc/cp/parser.c:21365 0x78b118 cp_parser_class_specifier ../../gcc-source-trunk/gcc/cp/parser.c:21601 0x78b118 cp_parser_type_specifier ../../gcc-source-trunk/gcc/cp/parser.c:15841 0x79fc23 cp_parser_decl_specifier_seq ../../gcc-source-trunk/gcc/cp/parser.c:12763 0x7ad111 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12304 0x7ad561 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12251 0x7b6940 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12148 0x7b5414 cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12027 0x7b5748 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4329 0x7b5748 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:37491 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. $ ------------------------ class A { int f (); enum { a = f }; };