I think I've found a compiler bug with templates. I've tested this code with VS2003, and VS2005 Beta 2. The following code will produce a warning when compiled, and I can't see any reason for the warning. I've simplified the code as much as possible while it is still producing the warning.
Thanks,
Niall.
c:\documents and settings\niall\my documents\visual studio 2005\projects\test\test\test.cpp(23) : warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data
void test(size_t x, unsigned int y)
{
}
template<typename T>
struct Traits
{
typedef T Parameter;
};
template<typename A, typename B>
class Functor
{
public:
typedef typename Traits<A>::Parameter Parm1;
typedef typename Traits<B>::Parameter Parm2;
void go(Parm1 p1, Parm2 p2) { test(p1,p2); }
};
void run()
{
size_t x = 100;
unsigned int y = 200;
Functor<size_t, unsigned int> f;
f.go(x,y); //compiler warning on this line!
}

compiler bug with templates, VC++2005
btrabucco
Melissa
Neelanjana
Jollyollyman