mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 14:05:19 +08:00
re PR c++/10552 (Small sample using nested templates causes internal compiler error.)
PR c++/10552 * pt.c (tsubst_copy): Handle TEMPLATE_DECL that is a member class template and has dependent context. * g++.dg/template/ttp6.C: New test. From-SVN: r66682
This commit is contained in:
parent
cdc958d823
commit
fcea74011f
@ -1,3 +1,9 @@
|
|||||||
|
2003-05-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||||
|
|
||||||
|
PR c++/10552
|
||||||
|
* pt.c (tsubst_copy): Handle TEMPLATE_DECL that is a member class
|
||||||
|
template and has dependent context.
|
||||||
|
|
||||||
2003-05-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
2003-05-10 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||||
|
|
||||||
* pt.c (instantiate_decl): Call push/pop_deferring_access_checks.
|
* pt.c (instantiate_decl): Call push/pop_deferring_access_checks.
|
||||||
|
22
gcc/cp/pt.c
22
gcc/cp/pt.c
@ -7294,7 +7294,29 @@ tsubst_copy (t, args, complain, in_decl)
|
|||||||
args, complain, in_decl);
|
args, complain, in_decl);
|
||||||
else if (is_member_template (t))
|
else if (is_member_template (t))
|
||||||
return tsubst (t, args, complain, in_decl);
|
return tsubst (t, args, complain, in_decl);
|
||||||
|
else if (DECL_CLASS_SCOPE_P (t)
|
||||||
|
&& uses_template_parms (DECL_CONTEXT (t)))
|
||||||
|
{
|
||||||
|
/* Template template argument like the following example need
|
||||||
|
special treatment:
|
||||||
|
|
||||||
|
template <template <class> class TT> struct C {};
|
||||||
|
template <class T> struct D {
|
||||||
|
template <class U> struct E {};
|
||||||
|
C<E> c; // #1
|
||||||
|
};
|
||||||
|
D<int> d; // #2
|
||||||
|
|
||||||
|
We are processing the template argument `E' in #1 for
|
||||||
|
the template instantiation #2. Originally, `E' is a
|
||||||
|
TEMPLATE_DECL with `D<T>' as its DECL_CONTEXT. Now we
|
||||||
|
have to substitute this with one having context `D<int>'. */
|
||||||
|
|
||||||
|
tree context = tsubst (DECL_CONTEXT (t), args, complain, in_decl);
|
||||||
|
return lookup_field (context, DECL_NAME(t), 0, false);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
/* Ordinary template template argument. */
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
case LOOKUP_EXPR:
|
case LOOKUP_EXPR:
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2003-05-11 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||||
|
|
||||||
|
PR c++/10552
|
||||||
|
* g++.dg/template/ttp6.C: New test.
|
||||||
|
|
||||||
2003-05-11 Richard Sandiford <rsandifo@redhat.com>
|
2003-05-11 Richard Sandiford <rsandifo@redhat.com>
|
||||||
|
|
||||||
* gcc.c-torture/execute/builtins: New directory.
|
* gcc.c-torture/execute/builtins: New directory.
|
||||||
|
21
gcc/testsuite/g++.dg/template/ttp6.C
Normal file
21
gcc/testsuite/g++.dg/template/ttp6.C
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
// Origin: Eelis van der Weegen <gccbugs@contacts.eelis.net>
|
||||||
|
|
||||||
|
// PR c++/10552: Member class template as template template argument
|
||||||
|
// substitution issue.
|
||||||
|
|
||||||
|
template <template <typename> class A, typename>
|
||||||
|
struct B
|
||||||
|
{
|
||||||
|
typedef typename A<int>::t t;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename D>
|
||||||
|
struct E
|
||||||
|
{
|
||||||
|
template <typename> struct F { typedef int t; };
|
||||||
|
typedef typename B<F, D>::t t;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef E<int>::t t;
|
Loading…
Reference in New Issue
Block a user