https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86205
Bug ID: 86205
Summary: ICE on valid C++11 code: in
type_dependent_expression_p, at cp/pt.c:25193
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
It appears to be a recent regression.
$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.0 20180618 (experimental) [trunk revision 261707] (GCC)
$
$ g++-8.1.0 -c tmp.cpp
$
$ g++tk -c tmp.cpp
tmp.cpp:8:68: internal compiler error: in type_dependent_expression_p, at
cp/pt.c:25193
template < class T > auto g () -> decltype (b ? f < int > : throw 0)
^
0x82c691 type_dependent_expression_p(tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:25192
0x831f97 instantiation_dependent_r
../../gcc-source-trunk/gcc/cp/pt.c:25322
0x1195df4 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../gcc-source-trunk/gcc/tree.c:11407
0x1195870 walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*,
default_hash_traits<tree_node*> >*))
../../gcc-source-trunk/gcc/tree.c:11749
0x826127 instantiation_dependent_uneval_expression_p(tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:25352
0x8b0533 finish_decltype_type(tree_node*, bool, int)
../../gcc-source-trunk/gcc/cp/semantics.c:8751
0x7ff66d cp_parser_decltype
../../gcc-source-trunk/gcc/cp/parser.c:14252
0x7fd95f cp_parser_simple_type_specifier
../../gcc-source-trunk/gcc/cp/parser.c:17158
0x7ee741 cp_parser_type_specifier
../../gcc-source-trunk/gcc/cp/parser.c:16945
0x7ef6e2 cp_parser_type_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:21219
0x7fb261 cp_parser_type_id_1
../../gcc-source-trunk/gcc/cp/parser.c:21062
0x7face7 cp_parser_trailing_type_id
../../gcc-source-trunk/gcc/cp/parser.c:21153
0x7face7 cp_parser_late_return_type_opt
../../gcc-source-trunk/gcc/cp/parser.c:20978
0x7face7 cp_parser_direct_declarator
../../gcc-source-trunk/gcc/cp/parser.c:20151
0x7face7 cp_parser_declarator
../../gcc-source-trunk/gcc/cp/parser.c:19982
0x808ff1 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:19499
0x80a141 cp_parser_single_declaration
../../gcc-source-trunk/gcc/cp/parser.c:27400
0x80a27c cp_parser_template_declaration_after_parameters
../../gcc-source-trunk/gcc/cp/parser.c:26999
0x80ab83 cp_parser_explicit_template_declaration
../../gcc-source-trunk/gcc/cp/parser.c:27233
0x80ab83 cp_parser_template_declaration_after_export
../../gcc-source-trunk/gcc/cp/parser.c:27251
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.
$
--------------------------------------------------
bool b;
template < class T > int f ()
{
return 0;
}
template < class T > auto g () -> decltype (b ? f < int > : throw 0)
{
return 0;
}