]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (grokdeclarator): Update the names of all variants when de-anonymizing.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 7 Jul 1999 00:35:59 +0000 (00:35 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 7 Jul 1999 00:35:59 +0000 (18:35 -0600)
        * decl.c (grokdeclarator): Update the names of all variants when
        de-anonymizing.
Brought over from the mainline tree.

From-SVN: r27980

gcc/cp/ChangeLog
gcc/cp/decl.c

index e90a51e8ba9c0d29f27faf2d22cfa0d0449b0a54..034b539fc7637638494254090a241985d1bdd237 100644 (file)
@@ -1,3 +1,8 @@
+1999-07-07  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (grokdeclarator): Update the names of all variants when
+       de-anonymizing.
+
 Wed Jul  7 01:26:47 1999  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * decl2.c (mark_vtable_entries): Fix check for rtti offset.
index 8afa043173ce3e021d0ace296463a5d6450f5dc6..29fd717aacf03a9f301ea0cb1f86baea9758d570 100644 (file)
@@ -11048,18 +11048,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
          && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
          && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
        {
+         tree oldname = TYPE_NAME (type);
+         tree t;
+
          /* FIXME: This is bogus; we should not be doing this for
                    cv-qualified types.  */
 
-         /* For anonymous structs that are cv-qualified, need to use
-             TYPE_MAIN_VARIANT so that name will mangle correctly. As
-             type not referenced after this block, don't bother
-             resetting type to original type, ie. TREE_TYPE (decl). */
-         type = TYPE_MAIN_VARIANT (type);
-
          /* Replace the anonymous name with the real name everywhere.  */
          lookup_tag_reverse (type, declarator);
-         TYPE_NAME (type) = decl;
+         for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
+           if (TYPE_NAME (t) == oldname)
+             TYPE_NAME (t) = decl;
 
          if (TYPE_LANG_SPECIFIC (type))
            TYPE_WAS_ANONYMOUS (type) = 1;