From e3c56d1b513077e7b7c4e0face59484e8597a8f4 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 11 Nov 1994 17:53:39 -0500 Subject: [PATCH] (duplicate_decls): Properly merge decls with differing DECL_CONTEXT. From-SVN: r8428 --- gcc/c-decl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 995009a4635..427ff3a7d37 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1698,11 +1698,16 @@ duplicate_decls (newdecl, olddecl) make_var_volatile (newdecl); } - /* Keep source location of definition rather than declaration. */ - if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) + /* Keep source location of definition rather than declaration. + Likewise, keep decl at outer scope. */ + if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) + || (DECL_CONTEXT (newdecl) != 0 && DECL_CONTEXT (olddecl) == 0)) { DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl); DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); + + if (DECL_CONTEXT (olddecl) == 0) + DECL_CONTEXT (newdecl) = 0; } /* Merge the unused-warning information. */ -- 2.30.2