https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124518
Bug ID: 124518
Summary: ICE: tree check: expected var_decl or function_decl,
have const_decl in non_const_var_error, at
cp/constexpr.cc:7601
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: suyuchang at whu dot edu.cn
Target Milestone: ---
Code:
template <typename = enum { a enum alignas(a
Command:
g++ test.cpp
Output:
test.cpp:1:44: internal compiler error: tree check: expected var_decl or
function_decl, have const_decl in non_const_var_error, at cp/constexpr.cc:7601
0x2cb8d8e internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xad0143 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-trunk/gcc/tree.cc:9219
0x83dd5b tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
../../gcc-trunk/gcc/tree.h:3799
0x83dd5b non_const_var_error
../../gcc-trunk/gcc/cp/constexpr.cc:7601
0xc7d750 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
../../gcc-trunk/gcc/cp/constexpr.cc:9283
0xc8c853 cxx_eval_outermost_constant_expr
../../gcc-trunk/gcc/cp/constexpr.cc:10938
0xc8e67f cxx_constant_value(tree_node*, tree_node*, int)
../../gcc-trunk/gcc/cp/constexpr.cc:11199
0xe4881d cp_parser_std_attribute_spec
../../gcc-trunk/gcc/cp/parser.cc:34030
0xe4881d cp_parser_std_attribute_spec_seq
../../gcc-trunk/gcc/cp/parser.cc:34080
0xe49052 cp_parser_attributes_opt
../../gcc-trunk/gcc/cp/parser.cc:32810
0xe49b96 cp_parser_enum_specifier
../../gcc-trunk/gcc/cp/parser.cc:23789
0xe3a423 cp_parser_type_specifier
../../gcc-trunk/gcc/cp/parser.cc:22307
0xe3a768 cp_parser_type_specifier_seq
../../gcc-trunk/gcc/cp/parser.cc:27993
0xe4813e cp_parser_type_id_1
../../gcc-trunk/gcc/cp/parser.cc:27756
0xe4da85 cp_parser_type_id
../../gcc-trunk/gcc/cp/parser.cc:27864
0xe4da85 cp_parser_default_type_template_argument
../../gcc-trunk/gcc/cp/parser.cc:20698
0xe6c4cb cp_parser_type_parameter
../../gcc-trunk/gcc/cp/parser.cc:20936
0xe51494 cp_parser_template_parameter
../../gcc-trunk/gcc/cp/parser.cc:20815
0xe51494 cp_parser_template_parameter_list
../../gcc-trunk/gcc/cp/parser.cc:20511
0xe6f975 cp_parser_explicit_template_declaration
../../gcc-trunk/gcc/cp/parser.cc:36316
/home/syc/gcc-16.0/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE test.cpp -quiet -dumpdir a-
-dumpbase test.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -o
/tmp/ccHsE5if.s
Goes back to a while: https://godbolt.org/z/PPcKrPb1s
The test case was generated by a fuzzer.