https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88528
Bug ID: 88528
Summary: Regression in gcc 7.4
Product: gcc
Version: 7.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: proski at gnu dot org
Target Milestone: ---
gcc 7.4.0 fails to compile some code that could be compiled with earlier
version of gcc 7.x. I don't see that issue with gcc 4.9.4, 5.5.0, 6.5.0 and
8.1.0. The issue still exists with the current gcc-7-branch (git revision
c51441f7f92fe9f4a0a452c1f8d283751ad463c5, timestamp 20181217).
The code:
template <int size>
struct A
{
const bool is_valid;
operator bool() const
{
return is_valid;
}
};
template <class T>
bool check_a()
{
const A<0> a {};
const bool a_valid {a};
return a_valid;
}
The output with the current gcc from the gcc-7-branch:
$ /opt/gcc/bin/gcc -std=c++14 -c test.cpp
test.cpp: In function ‘bool check_a()’:
test.cpp:15:24: internal compiler error: unexpected expression ‘(bool)a’ of
kind implicit_conv_expr
const bool a_valid {a};
^
0x6e2a5d cxx_eval_constant_expression
/home/roskinp/src/gcc/gcc/cp/constexpr.c:4697
0x6e4454 cxx_eval_outermost_constant_expr
/home/roskinp/src/gcc/gcc/cp/constexpr.c:4755
0x6e6391 maybe_constant_init(tree_node*, tree_node*)
/home/roskinp/src/gcc/gcc/cp/constexpr.c:5082
0x603c2f store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
/home/roskinp/src/gcc/gcc/cp/typeck2.c:832
0x5c105d check_initializer
/home/roskinp/src/gcc/gcc/cp/decl.c:6377
0x5c5691 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
/home/roskinp/src/gcc/gcc/cp/decl.c:6953
0x654d7f cp_parser_init_declarator
/home/roskinp/src/gcc/gcc/cp/parser.c:19468
0x6555cd cp_parser_simple_declaration
/home/roskinp/src/gcc/gcc/cp/parser.c:12844
0x656295 cp_parser_block_declaration
/home/roskinp/src/gcc/gcc/cp/parser.c:12669
0x656bb9 cp_parser_declaration_statement
/home/roskinp/src/gcc/gcc/cp/parser.c:12279
0x638247 cp_parser_statement
/home/roskinp/src/gcc/gcc/cp/parser.c:10754
0x63900d cp_parser_statement_seq_opt
/home/roskinp/src/gcc/gcc/cp/parser.c:11098
0x6390b7 cp_parser_compound_statement
/home/roskinp/src/gcc/gcc/cp/parser.c:11052
0x649f00 cp_parser_function_body
/home/roskinp/src/gcc/gcc/cp/parser.c:21521
0x649f00 cp_parser_ctor_initializer_opt_and_function_body
/home/roskinp/src/gcc/gcc/cp/parser.c:21559
0x6508f0 cp_parser_function_definition_after_declarator
/home/roskinp/src/gcc/gcc/cp/parser.c:26353
0x6551dd cp_parser_function_definition_from_specifiers_and_declarator
/home/roskinp/src/gcc/gcc/cp/parser.c:26265
0x6551dd cp_parser_init_declarator
/home/roskinp/src/gcc/gcc/cp/parser.c:19247
0x63430a cp_parser_single_declaration
/home/roskinp/src/gcc/gcc/cp/parser.c:26811
0x6501ec cp_parser_template_declaration_after_parameters
/home/roskinp/src/gcc/gcc/cp/parser.c:26415
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.