OSDN Git Service

* decl.c (grokfndecl): Set DECL_CONTEXT for static functions too.
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jun 2000 20:44:36 +0000 (20:44 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Jun 2000 20:44:36 +0000 (20:44 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34742 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.ns/ns19.C [new file with mode: 0644]

index e9f7b5f..e87c8ba 100644 (file)
@@ -1,3 +1,7 @@
+2000-06-27  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (grokfndecl): Set DECL_CONTEXT for static functions too.
+
 2000-06-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * search.c (hides): Remove.
index 6d82e5b..f5e28f7 100644 (file)
@@ -8862,7 +8862,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
   /* If this decl has namespace scope, set that up.  */
   if (in_namespace)
     set_decl_namespace (decl, in_namespace, friendp);
-  else if (publicp && ! ctype)
+  else if (!ctype)
     DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
 
   /* `main' and builtins have implicit 'C' linkage.  */
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns19.C b/gcc/testsuite/g++.old-deja/g++.ns/ns19.C
new file mode 100644 (file)
index 0000000..d08ec87
--- /dev/null
@@ -0,0 +1,7 @@
+// Build don't link:
+// Origin: Chip Salzenberg <chip@valinux.com>
+
+namespace N {
+enum { E = 0 };
+static int f() { return E; }
+}