re PR c++/42069 (ICE on class template specialization)

Fix PR c++/42069

gcc/cp/ChangeLog:
	PR c++/42069
	* pt.c (convert_template_argument): Strip typedefs from SCOPE_REFs.

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

From-SVN: r154768
This commit is contained in:
Dodji Seketeli 2009-11-30 09:58:20 +00:00 committed by Dodji Seketeli
parent 92a745f3c4
commit 3a3173c9d6
4 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-11-30 Dodji Seketeli <dodji@redhat.com>
PR c++/42069
* pt.c (convert_template_argument): Strip typedefs from SCOPE_REFs.
2009-11-29 Dodji Seketeli <dodji@redhat.com>
PR c++/36408

View File

@ -5526,6 +5526,13 @@ convert_template_argument (tree parm,
if (TYPE_P (val))
val = strip_typedefs (val);
}
else if (TREE_CODE (orig_arg) == SCOPE_REF)
{
/* Strip typedefs from the SCOPE_REF. */
tree type = strip_typedefs (TREE_TYPE (orig_arg));
tree scope = strip_typedefs (TREE_OPERAND (orig_arg, 0));
val = build2 (SCOPE_REF, type, scope, TREE_OPERAND (orig_arg, 1));
}
else
{
tree t = tsubst (TREE_TYPE (parm), args, complain, in_decl);

View File

@ -1,3 +1,8 @@
2009-11-30 Dodji Seketeli <dodji@redhat.com>
PR c++/42069
* g++.dg/template/typedef23.C: New test.
2009-11-29 H.J. Lu <hongjiu.lu@intel.com>
PR tree-optimization/41961

View File

@ -0,0 +1,25 @@
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/42069
// { dg-do compile }
struct A
{
static const int N = 0;
};
template<int> struct B {};
template<typename T, int>
struct C
{
typedef T U;
B<U::N> b;
};
template<typename T>
struct C<T*, 0>
{
B<T::N> b;
};
C<A*, 0> c;