This is the mail archive of the 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: enforce [] for static variables

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

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