This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc-4.0 non-local variable uses anonymous type warning
- From: William S Fulton <wsf at fultondesigns dot co dot uk>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 25 Apr 2005 05:36:11 +0100
- Subject: 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