diff options
| author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-07 16:15:45 +0000 |
|---|---|---|
| committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-07 16:15:45 +0000 |
| commit | 4ccf94d5b663bf9ad56453913bd1e103c03adf37 (patch) | |
| tree | 91c75aac457506aea43d77e9794ceba61ae50e63 /gcc/cp/decl.c | |
| parent | 92c82ec2c028020a17c7428b11efb0207265f568 (diff) | |
| download | ppe42-gcc-4ccf94d5b663bf9ad56453913bd1e103c03adf37.tar.gz ppe42-gcc-4ccf94d5b663bf9ad56453913bd1e103c03adf37.zip | |
cp:
PR c++/2914
* decl.c (pushtag): Don't push into a complete type's scope.
testsuite:
* g++.old-deja/g++.ext/anon3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
| -rw-r--r-- | gcc/cp/decl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ed5686c501f..22fb9ef7974 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2812,7 +2812,13 @@ pushtag (name, type, globalize) b = current_binding_level; while (b->tag_transparent - || (globalize && b->parm_flag == 2)) + || (b->parm_flag == 2 + && (globalize + /* We may be defining a new type in the initializer + of a static member variable. We allow this when + not pedantic, and it is particularly useful for + type punning via an anonymous union. */ + || COMPLETE_TYPE_P (b->this_class)))) b = b->level_chain; b->tags = tree_cons (name, type, b->tags); |

