It seems to be a bug. You can report it here
http://connect.microsoft.com/VisualStudio
From the error message I get that VC++ thinks that value_type::value_type from the return type of function f is a constructor even though you use typename. A quick (and really ugly solution) is to add another typedef to C template:
typedef T value_type2;
and define f as
template <typename T>
typename T::value_type::value_type2 f(T t)
{
return T::value_type::value_type(); //value_type2 not needed here. }
Maybe a better solution is this:
template<typename T>
struct f_return
{
typedef typename T::value_type::value_type f_return_type;
};
template<typename T>
typename f_return<T>::f_return_type f(T t)
{
return typename T::value_type::value_type();
}
It has the advantage that it keeps the C struct unchanged.
|