This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix for 10591, make variables in anonymous namespace static


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]