[Bug c++/51440] Improve message and add an option for warning for an unnamed struct member: TYPE has a field FIELD whose type uses the anonymous namespace

gcc at martinien dot de gcc-bugzilla@gcc.gnu.org
Sat Mar 30 22:06:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51440

--- Comment #5 from Martin Richtarsky <gcc at martinien dot de> 2013-03-30 22:06:48 UTC ---
Hi Manuel,

thanks for the pointers how to add the optional warning. I will try to submit a
patch, however first I would like to understand what is going on exactly:

- the volatile qualifier (could also be const) leads to internal linkage
- C++ has a default namespace for each translation unit where any code will be
located that has no explicit namespace, and the warning here says that this
structure will be local to this namespace for each translation unit that
includes it the header

Is this correct?

Would there be any kind of workaround to change this without removing the
volatile keyword?

I tried these:
- wrapping the include in extern "C": doesn't work

- wrapping the include in an explicit namespace statement: works


Best regards,
Martin



More information about the Gcc-bugs mailing list