http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60185
Bug ID: 60185
Summary: [4.9 Regression] ICE with invalid default parameter
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet triggers an ICE on trunk:
================================
template<int> struct A
{
int i;
A() { void foo(int=i); }
};
A<0> a;
================================
bug.cc: In instantiation of 'A<<anonymous> >::A() [with int <anonymous> = 0]':
bug.cc:7:6: required from here
bug.cc:4:14: internal compiler error: in tsubst_copy, at cp/pt.c:12375
A() { void foo(int=i); }
^
0x62bfa5 tsubst_copy
../../gcc/gcc/cp/pt.c:12375
0x60687b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:14974
0x607dcb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:14035
0x60895b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:14018
0x608054 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:14764
0x6115c6 tsubst_expr
../../gcc/gcc/cp/pt.c:13812
0x61862c tsubst_default_argument(tree_node*, tree_node*, tree_node*, int)
../../gcc/gcc/cp/pt.c:10094
0x631760 tsubst_default_arguments
../../gcc/gcc/cp/pt.c:10143
0x631760 tsubst_decl
../../gcc/gcc/cp/pt.c:10521
0x61be9f tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11357
0x6127fb tsubst_expr
../../gcc/gcc/cp/pt.c:13276
0x61208c tsubst_expr
../../gcc/gcc/cp/pt.c:13424
0x611093 tsubst_expr
../../gcc/gcc/cp/pt.c:13219
0x61208c tsubst_expr
../../gcc/gcc/cp/pt.c:13424
0x60f2a9 instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:19690
0x64d8c7 instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:19806
0x688bed cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4148
Please submit a full bug report, [etc.]
This is a recent regression, introduced between 2014-01-28 and 2014-02-01.
The bug is related to PR39055. It is actually the original testcase
of this PR (which never made it into the testsuite). Only a non-template
version of this testcase was added as
gcc/testsuite/g++.dg/overload/defarg5.C