Considering the example from this page, reproduced below
struct S {
static const int c;
};
const int d = 10 * S::c; // not a constant expression: S::c has no preceding
// initializer, this initialization happens after const
const int S::c = 5; // constant initialization, guaranteed to happen first
Why is the initialization of d not a constant expression (and therefore not a part of the constant initialization process)? The comment seems to say that it is because it uses a value that does not have a preceding initializer, but that does not seem to be mentioned in the list of conditions that qualify an expression to be a constant expression (The conditions are listed here). In particular which condition that qualifies something to be a constant expression does it violate?
If it has something to do with the fact that constant intialization has to be evaluated at compile time, then the standard mentions that constant initialization does not need to happen at compile time, and can even happen at say for example load time. Then why not just initialize c at compile time and just d at load time? (I might be thinking myself into a circle here)
Thanks to Jayesh I was able to find a similar question "surprising" constant initialization because of definition order but the answer seems to talk about an lvalue to rvalue conversion, where is the lvalue to rvalue conversion here? Other than that there was no quote from the standard there about which condition was being violated here. The answers also don't explain why the initialization is not split up into being at load time and at compile time.