I have a problem, where I can not instantiate a template with the type float, allthough it works just fine with an int.
The following code shows my problem:
template<typename T, T v>
struct Test
{
constexpr static T value = v;
};
int main()
{
Test<int, 1 >::value;
Test<float, 1.0f>::value;
return 0;
}
This program compiles perfectly fine, as long only the instantiation with int is present - as soon as I add the second line with float, the compilation failes with the error: " C993: 'float': illegal type for non-type parameter 'v' ". Does anybody have an idea on how to solve the problem and make it compile with float?
I am using MSVC and C++17.
Sincerely,
Lehks