The following code compiles and executed without any issues. I would have the compiler (GCC 9.2.0) expected to prevent me from this, but it doesn't. Can anyone point out the background of this effect to me?
#include <iostream>
const double c = 1.23456789;
void print(float f)
{
std::cout << (f == c) << std::endl;
}
int main()
{
double d=1.23456789;
print(d);
std::cout << (d == c) << std::endl;
return 0;
}
output (making clear that some implicit cast took place)
0
1