G
Gianni Mariani
I was a little surprised by this:
It seems like the code below should not compile but the Comeau 4.3.3
compiler accepts it and the gcc 3.4(prerel) compiler rejects it and
MSVC++7.1 ICE's.
14.6.1 in the standard seems to imply that template parameters are
hidden by class members.
struct X
{
struct C { int x; };
class Z { Z(int){} };
template<typename T,typename A, template<typename,typename> class C>
C<T, A> Func()
{
return C<T, A>(); // should find X::C which is not a template
}
template< typename Z > Z Zunc()
{
return Z(); //this is X::Z and fail on undefined constructor
}
template< typename Z > void Zinc()
{
}
void tst()
{
Zunc<int>();
Zinc<int>();
}
};
Notch that up to another C++ lesson.
It seems like the code below should not compile but the Comeau 4.3.3
compiler accepts it and the gcc 3.4(prerel) compiler rejects it and
MSVC++7.1 ICE's.
14.6.1 in the standard seems to imply that template parameters are
hidden by class members.
struct X
{
struct C { int x; };
class Z { Z(int){} };
template<typename T,typename A, template<typename,typename> class C>
C<T, A> Func()
{
return C<T, A>(); // should find X::C which is not a template
}
template< typename Z > Z Zunc()
{
return Z(); //this is X::Z and fail on undefined constructor
}
template< typename Z > void Zinc()
{
}
void tst()
{
Zunc<int>();
Zinc<int>();
}
};
Notch that up to another C++ lesson.