Compiling this code: struct Foo { struct Bar; Foo(); }; namespace Baz { Foo::Foo() { } struct Foo::Bar { }; }
Gives the following two error messages: test.C:6: error: definition of 'void Foo::Foo()' is not in namespace enclosing 'Foo' test.C:7: error: declaration of 'struct Foo::Bar' in 'Baz' which does not enclose 'struct Foo' The first error is nice and clear; the second would be much easier to understand quickly if it also identified 'Baz' as a namespace. Note: this bug dates back at least as far as g++-3.4.4 (tested on 3.4.4, 4.1.2, 4.2.0 and 4.3-20070716) -- Summary: Unclear error message when declaring struct in wrong namespace Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: trivial Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: scovich at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32870