This is the mail archive of the gcc@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: gcc-4.0 non-local variable uses anonymous type warning


William S Fulton wrote:
test.cxx:15: warning: non-local variable ‘<unnamed>::<anonymous enum> <unnamed>::Instance’ uses anonymous type

Just grepping the sources for the warning, I find this comment /* [basic.link]: A name with no linkage (notably, the name of a class or enumeration declared in a local scope) shall not be used to declare an entity with linkage. Only check this for public decls for now. */ Also this: /* DRs 132, 319 and 389 seem to indicate types with no linkage can only be used to declare extern "C" entities. Since it's not always an error in the ISO C++ 90 Standard, we only issue a warning. */

static enum { foo, bar = 10 } Instance;

The "public decls" comment above means that we deliberately don't emit the warning for static variables, but it is possible this may change in the future. It may depend on how the defect reports get resolved.


I'm not a C++ expert, and don't have a copy of the C++ standard, so I can't comment further.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



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