Using code::blocks + MinGW 4.5Code:template <typename T> struct trait { template <typename U> static void foo() {} }; template <typename T> class myClass { public: void bar() { trait<T>::foo<bool>(); //error: expected primary-expression before 'bool' //error: expected ';' before 'bool' } }; int main() { myClass<bool> a; a.bar(); }
Works fine with vs2008.
I'm at a loss. I expect some obscure C++ rule hiding template foo unless it is qualified in some way, but I just can't seem to figure it out...




Reply With Quote