I have an issue with VC++2010, and before opening a Microsoft Connect report I'd like to share the problem to see if I'm missing something or not;
consider the following code ( whose sole purpose is to reproduce the problem ):
so far so good, everything is ok as expected. But try defining f after declaration:Code:struct A {}; // a type struct B {}; // a trait value template < class T > struct C { typedef B type; }; // a trait class template < class T > void f( T, typename C<T>::type = C<T>::type() ) { /* whatever */ } int main(){ A a; f(a); }
and VC complains with the "error C2064: term does not evaluate to a function taking 0 arguments" referred to the declaration line ...Code:struct A {}; // a type struct B {}; // a trait value template < class T > struct C { typedef B type; }; // a trait class template < class T > void f( T, typename C<T>::type = C<T>::type() ); template < class T > void f( T, typename C<T>::type /* = C<T>::type() */ ) { /* whatever */ } int main(){ A a; f(a); }
ah, note that Comeau does not complain instead, as expected.




Reply With Quote