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



Reply via email to