https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85113
Bug ID: 85113
Summary: [7/8 Regression] ICE with __builtin_constant_p
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: ice-on-valid-code, rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
The following valid code snippet triggers an ICE on trunk:
=======================================
template<bool> struct A {};
constexpr int foo()
{
A<__builtin_constant_p(0)> a{};
return 0;
}
=======================================
bug.cc: In function 'constexpr int foo()':
bug.cc:5:28: internal compiler error: in coerce_template_parms, at cp/pt.c:8502
A<__builtin_constant_p(0)> a{};
^
0x64a25b coerce_template_parms
../../gcc/gcc/cp/pt.c:8502
0x97b406 lookup_template_class_1
../../gcc/gcc/cp/pt.c:9016
0x97b406 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:9365
0x9abdfd finish_template_type(tree_node*, tree_node*, int)
../../gcc/gcc/cp/semantics.c:3227
0x928364 cp_parser_template_id
../../gcc/gcc/cp/parser.c:15852
0x92846e cp_parser_class_name
../../gcc/gcc/cp/parser.c:22383
0x93521f cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:6580
0x93521f cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6266
0x936c35 cp_parser_simple_type_specifier
../../gcc/gcc/cp/parser.c:17179
0x930ce5 cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:16852
0x93e096 cp_parser_decl_specifier_seq
../../gcc/gcc/cp/parser.c:13627
0x943790 cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:12937
0x944738 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:12884
0x945169 cp_parser_declaration_statement
../../gcc/gcc/cp/parser.c:12478
0x9236d3 cp_parser_statement
../../gcc/gcc/cp/parser.c:10927
0x924640 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:11276
0x924717 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:11230
0x93b230 cp_parser_function_body
../../gcc/gcc/cp/parser.c:21789
0x93b230 cp_parser_ctor_initializer_opt_and_function_body
../../gcc/gcc/cp/parser.c:21826
0x93bae0 cp_parser_function_definition_after_declarator
../../gcc/gcc/cp/parser.c:26847
Please submit a full bug report, [etc.]
The regression was introduced between 2018-03-17 and 2018-03-20.
In addition the code is rejected on the GCC 7 branch (7.3.1)
while it was still accepted in GCC 7.3.0.