This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: enforce [basic.link] for static variables
On Mon, 08 Mar 2004 13:46:17 -0800, Mark Mitchell <mark@codesourcery.com> wrote:
> Geoffrey Keating wrote:
>
>>C++ doesn't allow variables with static linkage to have a type that
>>doesn't have linkage, and it's a mandatory diagnostic.
We discussed this at the last two C++ meetings:
http://std.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#389
> I think we should adjust this patch just to issue an error. That goes for
> functions too. (I understand that you were just mimicing the existing
> code.)
I disagree, I think a pedwarn is the right answer.
> The reason is that otherwise we'll do distinctly odd things during
> name-mangling, and -- I believe -- generate possible link-time failures
> that make no sense to people, or, worse yet, combine distinct variables at
> link-time.
Entities with internal linkage don't usually affect link-time behavior.
The resolution of the issue above prevents these non-names from leaking out
into template instantiations.
Jason