https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91933
Bug ID: 91933
Summary: [10 Regression] ICE: tree check: expected class
'type', have 'exceptional' (error_mark) in
build_simple_base_path, at cp/class.c:541
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: error-recovery, ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
g++-10.0.0-alpha20190929 snapshot (r276272) ICEs when compiling the following
testcase extracted from test/CXX/drs/dr20xx.cpp from the clang 9.0.0 test
suite:
struct NoMut1 { int a, b; };
struct NoMut3 : NoMut1 {
constexpr NoMut3(int a, int b) : NoMut1{a, b} {}
};
void mutable_subobjects() {
constexpr NoMut3 nm3 = {1, 2};
struct A {
void f() {
static_assert(nm3.a == 1, "");
}
};
}
% g++-10.0.0-alpha20190929 -c jigwb82y.cpp
jigwb82y.cpp: In member function 'void mutable_subobjects()::A::f()':
jigwb82y.cpp:9:21: error: use of local variable with automatic storage from
containing function
9 | static_assert(nm3.a == 1, "");
| ^~~
jigwb82y.cpp:6:20: note: 'constexpr const NoMut3 nm3' declared here
6 | constexpr NoMut3 nm3 = {1, 2};
| ^~~
jigwb82y.cpp:9:25: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in build_simple_base_path, at cp/class.c:541
9 | static_assert(nm3.a == 1, "");
| ^
0x7d4e37 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/tree.c:9973
0x5bb172 build_simple_base_path
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/tree.h:3390
0x8bfd62 build_simple_base_path
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/class.c:555
0x8d809d build_base_path(tree_code, tree_node*, tree_node*, int, int)
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/class.c:424
0xa7b714 build_class_member_access_expr(cp_expr, tree_node*, tree_node*, bool,
int)
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/typeck.c:2557
0xa825f3 finish_class_member_access_expr(cp_expr, tree_node*, bool, int)
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/typeck.c:3162
0x9ca816 cp_parser_postfix_dot_deref_expression
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:7800
0x9c0eca cp_parser_postfix_expression
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:7445
0x9a4db0 cp_parser_binary_expression
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:9479
0x9a5cd2 cp_parser_assignment_expression
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:9777
0x9a573e cp_parser_constant_expression
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:10071
0x9a59a7 cp_parser_static_assert
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:14505
0x9b4108 cp_parser_declaration_statement
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:13012
0x9b4ba0 cp_parser_statement
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:11337
0x9b5d25 cp_parser_statement_seq_opt
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:11699
0x9b5df5 cp_parser_compound_statement
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:11653
0x9cae29 cp_parser_function_body
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:22702
0x9cae29 cp_parser_ctor_initializer_opt_and_function_body
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:22753
0x9cdd55 cp_parser_function_definition_after_declarator
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:28074
0x9cef18 cp_parser_late_parsing_for_member
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/cp/parser.c:28959