diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-05-11 09:45:30 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-05-11 09:45:30 +0000 |
commit | fcea74011f2d59f310379d393799c353b7c54293 (patch) | |
tree | fafd1d159294e40e041c9c430a0138c23d9ef377 /gcc/cp | |
parent | cdc958d823386608ae27e2cda751711595dd838d (diff) | |
download | gcc-fcea74011f2d59f310379d393799c353b7c54293.zip gcc-fcea74011f2d59f310379d393799c353b7c54293.tar.gz gcc-fcea74011f2d59f310379d393799c353b7c54293.tar.bz2 |
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
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 22 |
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 77cfaac..9aa822b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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> * pt.c (instantiate_decl): Call push/pop_deferring_access_checks. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b4a9729..efc3774 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7294,7 +7294,29 @@ tsubst_copy (t, args, complain, in_decl) args, complain, in_decl); else if (is_member_template (t)) 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 + /* Ordinary template template argument. */ return t; case LOOKUP_EXPR: |