VS 2013 says that it cannot specialize the function template in the following code:
struct W { };
template <class T>
typename T::result_type
f (const W & w, T && t) {
return 0;
}
/* ... */
struct V { typedef int result_type; };
W w {};
V v {};
f (w, v);
If I replace typename T::result_type
by int
or if I replace the universal reference T&&
by T&
, it does not complain.
In my opinion, the above code is correct. Is this a compiler bug, or am I doing anything wrong?