Why is volatile not compiling with std::min

Viewed 1206

Why is following code not compilable (gcc-5.4.0)?

volatile int i{100};
int j{200};
std::cout << std::min(i, j);

I mean I see the compiler error:

error: no matching function for call to ‘min(volatile int&, int&)’

Isn't volatile just hint to compiler, that the variable could change from outside of the program?

std::min(int(i), j);

Is of course working. But shouldn't original work too?

2 Answers
Related