gcc-4.0 non-local variable uses anonymous type warning
William S Fulton
wsf@fultondesigns.co.uk
Mon Apr 25 07:48:00 GMT 2005
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
More information about the Gcc
mailing list