以下のコードを参照してください。f()はmain関数の下で定義されていますが、不正なものとみなされますか? 誰も私にこのことについて説明できますか?constexpr関数を順方向に定義する必要がありますか?
constexpr int f();
void indirection();
int main() {
constexpr int n = f(); // ill-formed, `int f()` is not yet defined
indirection();
}
constexpr int f() {
return 0;
}
void indirection() {
constexpr int n = f(); // ok
}