The following invalid code snippet ================================== void foo() { struct A { static int i; }; } ==================================
triggers a duplicate error message since GCC 3.1: bug.cc: In function 'void foo()': bug.cc:3: error: local class 'struct foo()::A' shall not have static data member 'int foo()::A::i' bug.cc:3: error: field 'foo()::A::i' in local class cannot be static The first error message was probably added back then because the second message isn't issued if foo is a template function. -- Summary: [4.0/4.1/4.2 regression] Duplicate message for static member in local class Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: diagnostic, monitored Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26573