内部クラス/無名ネームスペース/関数内クラスのダンプ

#include <iostream>

namespace hoge {

    class X {
    public:
        void test(){ std::cout << "in hoge namespace X.test" << std::endl;}
    };
    class XX {
    public:
        class YY {
            public:
            void test(){std::cout << "in hoge namespace XX::YY.test" << std::endl;}
        };
    };
};

namespace fuga {
    class X {
    public:
        void test(){ std::cout << "in fuga namespace X.test" << std::endl;}
    };
    class XX {
    public:
        class YY {
            public:
            void test(){std::cout << "in fuga namespace XX::YY.test" << std::endl;}
        };
    };

};

namespace {
    class X {
    public:
        void test(){ std::cout << "in anonymous namespace X.test" << std::endl;}
    };
    class XX {
    public:
        class YY {
            public:
            void test(){std::cout << "in anonymous namespace XX::YY.test" << std::endl;}
        };
    };
};


int somefunction(){
    class X {
    public:
        void test(){ std::cout << "in somefunction X.test" << std::endl;}
    };
    class XX {
    public:
        class YY {
            public:
            void test(){std::cout << "in somefunction XX::YY.test" << std::endl;}
        };
    };
    X().test();
    XX::YY().test();
    return 0;
}

/*
nm -C ./a.out | grep test
0000000000400864 t (anonymous namespace)::X::test()
000000000040088e t (anonymous namespace)::XX::YY::test()
00000000004009cc W fuga::X::test()
00000000004009f6 W fuga::XX::YY::test()
0000000000400978 W hoge::X::test()
00000000004009a2 W hoge::XX::YY::test()
00000000004008b8 t somefunction()::X::test()
00000000004008e2 t somefunction()::XX::YY::test()

*/
int main(){
    somefunction();
    X().test();
    XX::YY().test();
    hoge::X().test();
    hoge::XX::YY().test();
    fuga::X().test();
    fuga::XX::YY().test();
//    somefunction::X::test();
//    using namespace fuga;
//    X().test();
//    XX::YY().test();

}