re PR c++/40684 (ICE in tsubst)

2009-07-09  Dodji Seketeli  <dodji@redhat.com>

gcc/cp/ChangeLog:
	PR c++/40684
	* pt.c (type_unification_real): Use tsubst_template_arg instead
	of tsubst to substitute default template arguments.

gcc/testsuite/ChangeLog:
	PR c++/40684
	* g++.dg/template/unify11.C: New test.

From-SVN: r149423
This commit is contained in:
Dodji Seketeli 2009-07-09 17:56:44 +00:00 committed by Dodji Seketeli
parent 1aafbf9942
commit 8be2c87161
4 changed files with 50 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-07-09 Dodji Seketeli <dodji@redhat.com>
PR c++/40684
* pt.c (type_unification_real): Use tsubst_template_arg instead
of tsubst to substitute default template arguments.
2009-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/31246

View File

@ -12949,8 +12949,9 @@ type_unification_real (tree tparms,
to explicitly check cxx_dialect here. */
if (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)))
{
tree arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)),
targs, tf_none, NULL_TREE);
tree arg = tsubst_template_arg
(TREE_PURPOSE (TREE_VEC_ELT (tparms, i)),
targs, tf_none, NULL_TREE);
if (arg == error_mark_node)
return 1;
else

View File

@ -1,3 +1,8 @@
2009-07-09 Dodji Seketeli <dodji@redhat.com>
PR c++/40684
* g++.dg/template/unify11.C: New test.
2008-07-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40629

View File

@ -0,0 +1,36 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin: PR c++/40684
// { dg-options "-std=c++0x" }
struct A
{
};
template <typename S, typename T, typename U, typename S::v = &S::v::s>
typename S::A
foo (S c, T t, U u)
{
}
struct B
{
struct C
{
template <typename U>
C (U t)
{
A a;
A b = foo (this, a, t); // { dg-error "no matching function" }
}
} c;
B () : c (A ())
{
}
};
int
main ()
{
B f;
}