diff options
author | Benjamin Kosnik <bkoz@loony.cygnus.com> | 1998-08-17 15:44:47 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 1998-08-17 15:44:47 +0000 |
commit | 0d2a8b1b82b35370545d9fe9784d466314a9adf2 (patch) | |
tree | 98acaac051fc69b4dba921d505417cc9ae8db7ee /gcc | |
parent | 32f0e4a48f87bcb728dde66650629ecd8e50b044 (diff) | |
download | gcc-0d2a8b1b82b35370545d9fe9784d466314a9adf2.zip gcc-0d2a8b1b82b35370545d9fe9784d466314a9adf2.tar.gz gcc-0d2a8b1b82b35370545d9fe9784d466314a9adf2.tar.bz2 |
decl.c (grokdeclarator): Allow anonymous types to be cv-qualified.
1998-08-17 Benjamin Kosnik <bkoz@loony.cygnus.com>
* decl.c (grokdeclarator): Allow anonymous types to be cv-qualified.
fixes g++/16824
From-SVN: r21791
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a356da2..3f3fa49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1998-08-17 Benjamin Kosnik <bkoz@loony.cygnus.com> + + * decl.c (grokdeclarator): Allow anonymous types to be cv-qualified. + Mon Aug 17 10:40:18 1998 Jeffrey A Law (law@cygnus.com) * cp-tree.h (set_identifier_local_value): Provide prototype. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1fa4abf..ccaf757 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9957,11 +9957,16 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) refer to it, so nothing needs know about the name change. The TYPE_NAME field was filled in by build_struct_xref. */ if (type != error_mark_node - && !TYPE_READONLY (type) && !TYPE_VOLATILE (type) && TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type))) { + /* 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; |