This is about as simplified as I could make a toy example that still hit the bug:
struct Vector3f64 {
double x;
double y;
double z;
};
struct Ve
As mentioned by @NathanOliver the right solution is to upgrade to 15.9.5 where this is fixed. But barring that you can use result_of or invoke_result to solve that on 15.6.7 by changing call_t
to:
template<typename F, typename T>
using call_t = result_of_t<F&&(T, T, T)>;
Note that result_of
is deprecated in c++17 so if you are running with "/std:c++17" or "/std:c++latest" this won't work, you'll need to use the more convenient:
template<typename F, typename T>
using call_t = invoke_result_t<F, T, T, T>;
It's worth noting that Guillaume Racicot's answer used an elegant veradic template, which also works respectively as: template <typename F, typename... Args> using call_t = result_of_t<F&&(Args&&...)>
or template<typename F, typename... Args> using call_t = invoke_result_t<F, Args...>;
if you change your definition of func
to:
template <typename T>
call_t<decltype(&VectorVolume<param_vector<T>>), param_vector<T>, param_vector<T>, param_vector<T>> func(const T& param) {
return VectorVolume(param.x, param.y, param.z);
}