template enclosing in 4.1.0

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

 



Hello!

I enclose with this letter a very simple piece of code
I failed to compile by 4.1.0 while I have no troublles with 
older releases.

[class.mfct] says: A member function definition that appears outside of the class definition
shall appear in a namespace scope enclosing the class definition.

In my example B encloses class definition because of using directive,
doesn't it? What is the reason 4.1.0 reports an error? 

Any ideas how the code below could be compiled by 4.1.0 are highly appreciated.

Thanks.


[ilejn@pingvin tmp]$ cat aaa.cpp
namespace A
{
    template <typename T>
    class CL
    {
	T t;
    };
}

namespace B
{
    using namespace A;
}

namespace B
{
    template class CL<int>;
}

int main()
{
}
[ilejn@pingvin tmp]$ ~/gcc410/bin/g++ --version
g++ (GCC) 4.1.0
...
[ilejn@pingvin tmp]$ ~/gcc410/bin/g++ aaa.cpp
aaa.cpp:17: error: explicit instantiation of ▒class A::CL<int>▓ in namespace ▒B▓ (which does not enclose namespace ▒A▓)
[ilejn@pingvin tmp]$ /usr/bin/g++ --version
g++ (GCC) 4.0.0 20050519 (Red Hat 4.0.0-8)
...
[ilejn@pingvin tmp]$ /usr/bin/g++ aaa.cpp
[ilejn@pingvin tmp]$


-- 
Best regards
Ilja Golshtein

[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