https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92365
Bug ID: 92365
Summary: ice unexpected expression ‘int16_t()’ of kind
cast_expr
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
For this C++ code:
typedef short int16_t;
class a {
public:
a(char *);
};
enum b {};
class c {
public:
b g;
};
void d() {
c e;
a f(reinterpret_cast<char *>(d));
switch (e.g)
int16_t f;
}
compiled by recent gcc trunk and compiler flag -std=c++98, does this:
bug559.cc: In function ‘void d()’:
bug559.cc:15:13: internal compiler error: unexpected expression ‘int16_t()’ of
kind cast_expr
15 | int16_t f;
| ^
0x90ed37 cxx_eval_constant_expression
../../trunk/gcc/cp/constexpr.c:5669
0x90f1e2 cxx_eval_outermost_constant_expr
../../trunk/gcc/cp/constexpr.c:5858
0x91413a maybe_constant_value(tree_node*, tree_node*, bool)
../../trunk/gcc/cp/constexpr.c:6128
0x91413a fold_non_dependent_expr(tree_node*, int, bool, tree_node*)
../../trunk/gcc/cp/constexpr.c:6239
Problem first seems to occur between 277650 and 277700.