C++ Namespace Regression
Mark Mitchell
mark@codesourcery.com
Tue Jun 27 13:45:00 GMT 2000
>>>>> "Chip" == Chip Salzenberg <chip@valinux.com> writes:
Chip> Apparently, a recent change broke the installation of
Chip> function definitions into namespaces. Consider this source
Chip> file:
This got broken with:
2000-06-24 Jason Merrill <jason@redhat.com>
* decl.c (pushdecl): Don't set DECL_CONTEXT from current_namespace.
(push_namespace): Set DECL_CONTEXT for a new NAMESPACE_DECL.
because that (correct) change exposed a latent oddness in grokfndecl.
Fixed thus.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2000-06-27 Mark Mitchell <mark@codesourcery.com>
* decl.c (grokfndecl): Set DECL_CONTEXT for static functions too.
Index: testsuite/g++.old-deja/g++.ns/ns19.C
===================================================================
RCS file: ns19.C
diff -N ns19.C
*** /dev/null Tue May 5 13:32:27 1998
--- ns19.C Tue Jun 27 13:41:52 2000
***************
*** 0 ****
--- 1,7 ----
+ // Build don't link:
+ // Origin: Chip Salzenberg <chip@valinux.com>
+
+ namespace N {
+ enum { E = 0 };
+ static int f() { return E; }
+ }
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.643
diff -c -p -r1.643 decl.c
*** decl.c 2000/06/24 22:17:13 1.643
--- decl.c 2000/06/27 20:42:04
*************** grokfndecl (ctype, type, declarator, ori
*** 8862,8868 ****
/* If this decl has namespace scope, set that up. */
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
! else if (publicp && ! ctype)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
/* `main' and builtins have implicit 'C' linkage. */
--- 8862,8868 ----
/* If this decl has namespace scope, set that up. */
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
! else if (!ctype)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
/* `main' and builtins have implicit 'C' linkage. */
More information about the Gcc-bugs
mailing list