According to the C++23 standard, what is the output of this program?
#include <iostream>
void f(int) { std::cout << "i"; }
void f(double) { std::cout << "d"; }
void f(float) { std::cout << "f"; }
int main() {
f(1.0);
}What's the type of a floating point literal?
d
According to §[lex.fcon]¶1 in the standard:
The type of a floating-point-literal (§[basic.fundamental], §[basic.extended.fp]) is determined by its floating-point-suffix as specified in Table 11.
And Table 11 maps floating-point-suffix "none" to "double".
The best overload is therefore void f(double).