The following does not work: #include <iostream> class A { private: namespace B { enum { aaa, bbb }; } public: int getB() const { return B::bbb; } };
int main() { A objA; std::cout << objA.getB() << std::endl; return 0; } However, the following gives the same interface, and does work as a work-a-round: #include <iostream> class A { private: class B { public: enum { aaa, bbb }; }; public: int getB() const { return B::bbb; } }; int main() { A objA; std::cout << objA.getB() << std::endl; return 0; } The code in the first example is valid code, right? There is no reason for it now to be invalid? Thanks -- Summary: namespace nested in class is a parse error Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mjtruog at fastmail dot ca GCC build triplet: gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) GCC host triplet: Linux 2.6.27-9-generic #1 SMP Thu Nov 20 22:15:32 UTC 2008 x86_6 GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40423