Hi,
VC7.1 compiles the following, however, CW9, GCC 3.4.0, and
Comeau reject it:
#include <iostream>
#include <typeinfo>
class Test1 {};
class Test2 {};
class Test3 {};
template< typename T >
struct Cont { T t; };
template< typename T >
class TT { public: TT(T) {} };
struct X {
template< template<typename> class TT, typename T >
static void f(const T& t)
{
std::cout << '\t' << typeid(t).name() << std::endl;
}
template< template<typename> class TT >
static void f(const Test3& t)
{
std::cout << '\t' << typeid(t).name() << std::endl;
}
template< template<typename> class TT, typename T >
static void f(const Cont<T>& c)
{
f<TT>( c.t ); // <== error here
}
};
int main()
{
Cont<Test1> c1;
Cont<Test2> c2;
Cont<Test3> c3;
X::f< TT, Test1 >(c1);
X::f< TT, Test2 >(c2);
X::f< TT, Test3 >(c3);
return 0;
}
I had to learn that the call marked with "error here"
is ambigous.
TIA,
Schobi
--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org
"Sometimes compilers are so much more reasonable than people."
Scott Meyers
Carl Daniel [VC++ MVP] - 30 Apr 2004 20:41 GMT
> Hi,
>
> VC7.1 compiles the following, however, CW9, GCC 3.4.0, and
> Comeau reject it:
Whidbey accepts it as well. I'll submit it as a bug report if no one beats
me to it.
-cd
Hendrik Schober - 03 May 2004 11:10 GMT
> > Hi,
> >
[quoted text clipped - 3 lines]
> Whidbey accepts it as well. I'll submit it as a bug report if no one beats
> me to it.
Thanks, Carl!
> -cd
Schobi

Signature
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org
"Sometimes compilers are so much more reasonable than people."
Scott Meyers