diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-07-07 00:35:59 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-07-06 18:35:59 -0600 |
commit | 54a8bce40476720acf5b53bf1f1c2e6b96a916e2 (patch) | |
tree | 4ef09fdc539ffd452e5c8d1733e0e7b6785dc15c | |
parent | ae1749fd1732ca3b6a114eb0cea4eb69fea24c48 (diff) | |
download | gcc-54a8bce40476720acf5b53bf1f1c2e6b96a916e2.tar.gz |
decl.c (grokdeclarator): Update the names of all variants when de-anonymizing.
* decl.c (grokdeclarator): Update the names of all variants when
de-anonymizing.
Brought over from the mainline tree.
From-SVN: r27980
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 13 |
2 files changed, 11 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e90a51e8ba9..034b539fc76 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8afa043173c..29fd717aacf 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; |