diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-04-25 08:31:19 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-04-25 08:31:19 +0000 |
commit | 6bda7a5e41bfca06a2cfdabbeb1c49948c8ab9eb (patch) | |
tree | ef721534e660501653ea55caa7abccbc52394844 /gcc/cp | |
parent | 12da8316cc54ad403a1c9dc5cd236c3f34727cd5 (diff) | |
download | gcc-6bda7a5e41bfca06a2cfdabbeb1c49948c8ab9eb.zip gcc-6bda7a5e41bfca06a2cfdabbeb1c49948c8ab9eb.tar.gz gcc-6bda7a5e41bfca06a2cfdabbeb1c49948c8ab9eb.tar.bz2 |
decl.c (grokdeclarator): Set context of namespace scope TYPE_DECLS.
cp:
* decl.c (grokdeclarator): Set context of namespace scope
TYPE_DECLS.
testsuite:
* g++.old-deja/g++.ns/type2.C: New test.
From-SVN: r41533
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 618ba0d..4ea7d43 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-04-25 Nathan Sidwell <nathan@codesourcery.com> + + * decl.c (grokdeclarator): Set context of namespace scope + TYPE_DECLS. + 2001-04-24 Zack Weinberg <zackw@stanford.edu> * cp/optimize.c: Include hashtab.h. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 834e2dc..ea37eb4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11035,8 +11035,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) decl = build_lang_decl (TYPE_DECL, declarator, type); } else - decl = build_decl (TYPE_DECL, declarator, type); - + { + decl = build_decl (TYPE_DECL, declarator, type); + if (!current_function_decl) + DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); + } + /* If the user declares "typedef struct {...} foo" then the struct will have an anonymous name. Fill that name in now. Nothing can refer to it, so nothing needs know about the name |