The standard on constexpr functions states under point 5 of [decl.constexpr]:
For a non-template, non-defaulted constexpr function or a non-template, non-defaulted, non-inheriting constexpr constructor, if no argument values exist such that an invocation of the function or constructor could be an evaluated subexpression of a core constant expression (5.19), the program is ill-formed; no diagnostic required.
It goes on to give the following example for this:
constexpr int f(bool b){ return b ? throw 0 : 0; } // OK
constexpr int f() { return f(true); } // ill-formed, no diagnostic required
What I take from this is that functions with empty argument lists are no-diagnostic ill-formed. This strikes me as extremely bizarre, such that I suspect that my understanding is incorrect. For instance, would this also be ill-formed:
constexpr int g() { return 0; } // ill-formed?
If so, what is the rationale behind this, and if not what does the qualification mean / when does a constexpr function become ill-formed?
Presumably the following are fine?
constexpr int h(int x) { return x; } // presumably fine?
constexpr int l = h(42); // also fine