aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-12-09 11:46:02 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-12-09 11:46:02 +0000
commit33964bf4af75b5e6de8ef1b51979a6d96032b54b (patch)
treeb28a92b457928ac38f806da8e59d485852428a53
parenta0078b37091b7e4d7447f7e9cb482bbc55e8121b (diff)
downloadgcc-33964bf4af75b5e6de8ef1b51979a6d96032b54b.zip
gcc-33964bf4af75b5e6de8ef1b51979a6d96032b54b.tar.gz
gcc-33964bf4af75b5e6de8ef1b51979a6d96032b54b.tar.bz2
decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL...
* decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL, as well as the TYPE_DECL, when a typedef name is assigned to a previously anonymous type. From-SVN: r24218
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/derived1.C24
3 files changed, 37 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 40280af..fc5d228 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1998-12-09 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL, as
+ well as the TYPE_DECL, when a typedef name is assigned to a
+ previously anonymous type.
+
1998-12-08 Andrew MacLeod <amacleod@cygnus.com>
* cp/except.c (call_eh_info): use __start_cp_handler instead of
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 260053b..6f23465 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10378,6 +10378,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (TYPE_LANG_SPECIFIC (type))
TYPE_WAS_ANONYMOUS (type) = 1;
+ /* If this is a typedef within a template class, the nested
+ type is a (non-primary) template. The name for the
+ template needs updating as well. */
+ if (TYPE_LANG_SPECIFIC (type) && CLASSTYPE_TEMPLATE_INFO (type))
+ DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
+ = TYPE_IDENTIFIER (type);
+
/* XXX Temporarily set the scope.
When returning, start_decl expects it as NULL_TREE,
and will then then set it using pushdecl. */
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/derived1.C b/gcc/testsuite/g++.old-deja/g++.pt/derived1.C
new file mode 100644
index 0000000..e2275f4
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/derived1.C
@@ -0,0 +1,24 @@
+// Build don't link:
+
+class A
+{
+public:
+ typedef int Info;
+};
+
+template <class T>
+class B : public A
+{
+public:
+ typedef struct{
+ int a;
+ int b;
+ } Info;
+};
+
+void f()
+{
+ B<A>::Info ie;
+ ie.a=1;
+ ie.b=2;
+}