This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ Namespace Regression
- To: chip at valinux dot com
- Subject: Re: C++ Namespace Regression
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 27 Jun 2000 13:44:59 -0700
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <20000626130253.A461@perlsupport.com>
>>>>> "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. */