enforce [basic.link] for static variables
Mark Mitchell
mark@codesourcery.com
Fri Mar 19 08:14:00 GMT 2004
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 have this
>for functions already, so I made the compiler treat variables just
>like functions for this case. Variables with C linkage are exempted,
>just like functions; this should avoid problems with non-C++-aware
>headers. People whose code is broken can use -fpermissive to turn the
>error into a warning (just like every other time the C++ compiler
>becomes stricter).
>
>Bootstrapped & tested on powerpc-darwin. I'll wait a bit in case
>people have objections.
>
>
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.)
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.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com
More information about the Gcc-patches
mailing list