diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 |