If this is not a typo, then in this statement
int minX = max(min(floor(v1[0]), min(floor(v2[0]), floor(v3[0]))), 0.0);
the integer literal 9.9 is of type double , while the other operands are of type float. Therefore, the compiler cannot decide whether to use the template argument float or double
The error message states that for the function
'const _Ty &std::max(const _Ty &,const _Ty &)'
there could be 'double' or 'float'
This function call looks like
std::max( float_value, double_value );
You can explicitly specify a template argument, for example,
std::max<double>( float_value, double_value );
or
std::max<float>( float_value, double_value );
As for GCC, it puts the standard C floor function, which has a double return type in the global namespace.
double floor(double x);
Thus, operands after applying this function are converted to type double. But it looks like MS VC ++ does not put this function in the global namespace or the global namespace in MS VC ++ has overloaded functions with the same name.
So the problem is which floor function each compiler fits into the global namespace.
I think that if you used the qualified name std::floor , then GCC will also throw an error.
So, in your code, MS VC ++ uses the function
float floor(float x);
and the result is an error, and GCC uses the function
double floor(double x);
and all operands of the std::max function are of type double , and the code compiled successfully. :)