This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32870] New: Unclear error message when declaring struct in wrong namespace
- From: "scovich at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jul 2007 19:22:46 -0000
- Subject: [Bug c++/32870] New: Unclear error message when declaring struct in wrong namespace
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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