enum crap {
foo = 1
};
class foo {
};
int main(int argc, char **argv)
{
foo *a=new foo;
}
results in
test.cpp: In function 'int main(int, char**)':
test.cpp:10: error: 'a' was not declared in this scope
test.cpp:10: error: expected type-specifier before 'foo'
test.cpp:10: error: expected `;' before 'foo'
Which does not describe the problem very well.
It would be nicer to get
test.cpp:5: error: 'foo' already declared
Or, analogous to another existing warning,
test.cpp:2: warning: declaration of enum value 'foo' shadows class 'foo'
--
Summary: Error/warning on invalid code (duplicate identifier for
enum/class) should be more specific
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bero at arklinux dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30060