namespace and class within with similar name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have the following code and I wonder why C++ complains.

namespace S {

class L;
class S;

}

using namespace S;

class C {
    void m(::S::L *l) {};
};

$ g++ main.5.cpp
main.5.cpp:12: error: ‘struct S::S::L’ has not been declared

Shouldn't it be clear that I wan't to access class L in
namespace S and not some L of class S in namespace S ?

Couriously I only get this error on some compilers:
gcc 4.1 and gcc 4.2.3 produce this error while
gcc 3.2.2 and xlc work as expected.

Any idea besides complaining about why I want to do this at all ? ;)

Alexander




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux