aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Samuel <samuel@codesourcery.com>1999-08-30 05:22:45 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-08-30 05:22:45 +0000
commit1c10870d31b0112b409fef7241126a81d8b4f63b (patch)
treee134c7528d6d639f5898070cba606742b39fe03c
parent0d54c3f607f3a1a74dae33f3ee537ec2546167da (diff)
downloadgcc-1c10870d31b0112b409fef7241126a81d8b4f63b.zip
gcc-1c10870d31b0112b409fef7241126a81d8b4f63b.tar.gz
gcc-1c10870d31b0112b409fef7241126a81d8b4f63b.tar.bz2
pt.c (push_template_decl_real): Use template declaration from class type if it exists.
* pt.c (push_template_decl_real): Use template declaration from class type if it exists. From-SVN: r28978
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/template14.C14
3 files changed, 35 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0fa5c60..4a8fd5a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1999-08-29 Alex Samuel <samuel@codesourcery.com>
+
+ * pt.c (push_template_decl_real): Use template declaration from
+ class type if it exists.
+
1999-08-29 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (TYPE_NEEDS_CONSTRUCTING): Remove #if 0'd definition.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e321c34..ee6f85a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2461,6 +2461,22 @@ push_template_decl_real (decl, is_friend)
&& DECL_TEMPLATE_INFO (decl)
&& DECL_TI_TEMPLATE (decl))
tmpl = DECL_TI_TEMPLATE (decl);
+ /* If DECL is a TYPE_DECL for a class-template, then there won't
+ be DECL_LANG_SPECIFIC. The information equivalent to
+ DECL_TEMPLATE_INFO is found in TYPE_TEMPLATE_INFO instead. */
+ else if (DECL_IMPLICIT_TYPEDEF_P (decl)
+ && TYPE_TEMPLATE_INFO (TREE_TYPE (decl))
+ && TYPE_TI_TEMPLATE (TREE_TYPE (decl)))
+ {
+ /* Since a template declaration already existed for this
+ class-type, we must be redeclaring it here. Make sure
+ that the redeclaration is legal. */
+ redeclare_class_template (TREE_TYPE (decl),
+ current_template_parms);
+ /* We don't need to create a new TEMPLATE_DECL; just use the
+ one we already had. */
+ tmpl = TYPE_TI_TEMPLATE (TREE_TYPE (decl));
+ }
else
{
tmpl = build_template_decl (decl, current_template_parms);
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template14.C b/gcc/testsuite/g++.old-deja/g++.ns/template14.C
new file mode 100644
index 0000000..90e5312
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ns/template14.C
@@ -0,0 +1,14 @@
+// Build don't link:
+// Origin: Alex Samuel <samuel@codesourcery.com>
+
+namespace Outer
+{
+template <class T> class Inner;
+}
+
+template <class T>
+class Outer::Inner
+{
+public:
+ Inner ();
+};