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]

gcc-4.0 non-local variable uses anonymous type warning


Does anyone know the point of the following warning, introduced with gcc-4.0:

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

for this code:

  namespace {
    enum { foo, bar = 10 } Instance;
  }

Gcc issues this with default warning levels for enums and classes, whether or not the anonymously declared type is declared within an anonymous namespace. What is the point of the warning? Is there anything wrong with using an anonymous type? How is it different to this, which doesn't issue the warning:

static enum { foo, bar = 10 } Instance;

Thanks,

William


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