Bug 81843 - [8 Regression] ICE on valid C++11 code with variadic templates: in tsubst_pack_expansion, at cp/pt.c:11524
Summary: [8 Regression] ICE on valid C++11 code with variadic templates: in tsubst_pac...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2017-08-15 13:46 UTC by Zhendong Su
Modified: 2018-01-17 18:57 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-08-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2017-08-15 13:46:53 UTC
$ g++-trunk -v  
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170814 (experimental) [trunk revision 251096] (GCC) 
$ 
$ g++-6.2 -c -std=c++11 small.cpp
$ clang++-4.0.0 -c -std=c++11 small.cpp
$ icc -c -std=c++11 small.cpp
$ 
$ g++-trunk -c -std=c++11 small.cpp
small.cpp: In instantiation of ‘struct C<>::D<A<B<int, int> > >’:
small.cpp:9:34:   required from here
small.cpp:5:34: internal compiler error: in tsubst_pack_expansion, at cp/pt.c:11524
   template < typename > struct D {};
                                  ^
0x863095 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
	../../gcc-source-trunk/gcc/cp/pt.c:11524
0x863a1a tsubst_template_args
	../../gcc-source-trunk/gcc/cp/pt.c:11749
0x8638b1 tsubst_template_args
	../../gcc-source-trunk/gcc/cp/pt.c:11768
0x864064 tsubst_aggr_type
	../../gcc-source-trunk/gcc/cp/pt.c:11981
0x864195 tsubst_aggr_type
	../../gcc-source-trunk/gcc/cp/pt.c:11965
0x85d9cd tsubst_decl
	../../gcc-source-trunk/gcc/cp/pt.c:12809
0x865f56 tsubst(tree_node*, tree_node*, int, tree_node*)
	../../gcc-source-trunk/gcc/cp/pt.c:13389
0x893aa6 instantiate_class_template_1
	../../gcc-source-trunk/gcc/cp/pt.c:10608
0x893aa6 instantiate_class_template(tree_node*)
	../../gcc-source-trunk/gcc/cp/pt.c:10892
0x8ee9a2 complete_type(tree_node*)
	../../gcc-source-trunk/gcc/cp/typeck.c:136
0x7375c7 start_decl_1(tree_node*, bool)
	../../gcc-source-trunk/gcc/cp/decl.c:5128
0x75e228 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**)
	../../gcc-source-trunk/gcc/cp/decl.c:5091
0x81ef30 cp_parser_init_declarator
	../../gcc-source-trunk/gcc/cp/parser.c:19543
0x821d6f cp_parser_simple_declaration
	../../gcc-source-trunk/gcc/cp/parser.c:13059
0x822c3a cp_parser_block_declaration
	../../gcc-source-trunk/gcc/cp/parser.c:12877
0x82af34 cp_parser_declaration
	../../gcc-source-trunk/gcc/cp/parser.c:12774
0x829936 cp_parser_declaration_seq_opt
	../../gcc-source-trunk/gcc/cp/parser.c:12650
0x829c54 cp_parser_translation_unit
	../../gcc-source-trunk/gcc/cp/parser.c:4387
0x829c54 c_parse_file()
	../../gcc-source-trunk/gcc/cp/parser.c:38894
0x971f55 c_common_parse_file()
	../../gcc-source-trunk/gcc/c-family/c-opts.c:1106
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.
$ 


-----------------------------------------------------------------


template < typename > struct A;
template < typename, typename > struct B;
template < typename ... S > struct C
{
  template < typename > struct D {};
  template < typename ... T > struct D < A < B < S, T > ... > >;
};

C <>::D < A < B < int, int > > > c;
Comment 1 Martin Liška 2017-08-16 07:43:34 UTC
Confirmed, started with r249755.
Comment 2 Jason Merrill 2018-01-17 17:45:22 UTC
Author: jason
Date: Wed Jan 17 17:44:35 2018
New Revision: 256802

URL: https://gcc.gnu.org/viewcvs?rev=256802&root=gcc&view=rev
Log:
	PR c++/81843 - ICE with variadic member template.

	PR c++/72801
	* pt.c (unify_pack_expansion): Don't try to deduce enclosing
	template args.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic171.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
Comment 3 Jason Merrill 2018-01-17 18:08:39 UTC
Author: jason
Date: Wed Jan 17 18:08:05 2018
New Revision: 256808

URL: https://gcc.gnu.org/viewcvs?rev=256808&root=gcc&view=rev
Log:
	PR c++/81843 - ICE with variadic member template.

	PR c++/72801
	* pt.c (unify_pack_expansion): Don't try to deduce enclosing
	template args.

Added:
    branches/gcc-7-branch/gcc/testsuite/g++.dg/cpp0x/variadic171.C
Modified:
    branches/gcc-7-branch/gcc/cp/ChangeLog
    branches/gcc-7-branch/gcc/cp/pt.c
Comment 4 Jason Merrill 2018-01-17 18:57:13 UTC
Fixed.