This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix for 10591, make variables in anonymous namespace static
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gkeating at apple dot com (Geoffrey Keating), gcc-patches at gcc dot gnu dot org
- Date: 05 Dec 2003 00:02:06 +0100
- Subject: Re: Fix for 10591, make variables in anonymous namespace static
- Organization: Integrable Solutions
- References: <20031204211922.9AC69733F74@geoffk4.apple.com><xyp65gwfbb1.fsf@miranda.boston.redhat.com>
Jason Merrill <jason@redhat.com> writes:
| On Thu, 4 Dec 2003 13:19:22 -0800 (PST), gkeating@apple.com (Geoffrey Keating) wrote:
|
| > * decl.c (grokvardecl): Make declarations in the anonymous
| > namespace not be visible outside this module.
|
| I'm dubious. The whole point of the anonymous namespace is that
| declarations have external linkage, so that their addresses can be used as
| template arguments. This may not be important now, but it will be once we
| implement export.
Yes. And note that name lookup is affected as well. In the second
stage of name lookup, functions with internal linkage are ignored.
So, if we give internal linkage to members of unnamed namespaces,
then we will compute the wrong result.
Unnamed namespaces are not exactly an alternate spelling for C old
"static" :-)
-- Gaby