https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83947
Bug ID: 83947
Summary: ICE on invalid C++ code with auto: in tsubst_decl, at
cp/pt.c:13046
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: ---
This 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/8.0.1/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 8.0.1 20180117 (experimental) [trunk revision 256779] (GCC)
$
$ g++-7.2.0 -c tmp.cpp
tmp.cpp: In instantiation of ‘auto g<0>’:
tmp.cpp:3:10: required from here
tmp.cpp:2:23: error: use of ‘auto f()’ before deduction of ‘auto’
template < int > auto g (f);
^
$
$ g++tk -c tmp.cpp
tmp.cpp:2:23: internal compiler error: in tsubst_decl, at cp/pt.c:13046
template < int > auto g (f);
^
0x86faa0 tsubst_decl
../../gcc-source-trunk/gcc/cp/pt.c:13046
0x876996 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-source-trunk/gcc/cp/pt.c:13562
0x8749b5 instantiate_template_1
../../gcc-source-trunk/gcc/cp/pt.c:18569
0x8749b5 instantiate_template(tree_node*, tree_node*, int)
../../gcc-source-trunk/gcc/cp/pt.c:18625
0x8c81b6 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
../../gcc-source-trunk/gcc/cp/semantics.c:3679
0x80a1a2 cp_parser_primary_expression
../../gcc-source-trunk/gcc/cp/parser.c:5615
0x817443 cp_parser_postfix_expression
../../gcc-source-trunk/gcc/cp/parser.c:7029
0x82087c cp_parser_unary_expression
../../gcc-source-trunk/gcc/cp/parser.c:8281
0x7fa8a9 cp_parser_cast_expression
../../gcc-source-trunk/gcc/cp/parser.c:9049
0x7fafa5 cp_parser_binary_expression
../../gcc-source-trunk/gcc/cp/parser.c:9151
0x7fb890 cp_parser_assignment_expression
../../gcc-source-trunk/gcc/cp/parser.c:9439
0x7fc883 cp_parser_constant_expression
../../gcc-source-trunk/gcc/cp/parser.c:9721
0x7fcd67 cp_parser_initializer_clause
../../gcc-source-trunk/gcc/cp/parser.c:21842
0x7ffcfb cp_parser_initializer
../../gcc-source-trunk/gcc/cp/parser.c:21780
0x8227a4 cp_parser_init_declarator
../../gcc-source-trunk/gcc/cp/parser.c:19601
0x824248 cp_parser_simple_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12997
0x8250cf cp_parser_block_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12815
0x830770 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12712
0x82f3b4 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12588
0x82f6f7 cp_parser_translation_unit
../../gcc-source-trunk/gcc/cp/parser.c:4559
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.
$
-------------------------------
auto f ();
template < int > auto g (f);
auto h = g < 0 > ();