| What link-time or load-time constants do you mean to exclude?
What I meant was that there are expressions that may be found link-time or
load-time constants by that we cannot legitimately consider compile time
constant from the languge point of view. For example, I had in mind
this scenario
constexpr int n = 8;
int m = n * 8;
int main() {
return m;
}
'm' may be considered a load-time constant, but we should not accept it.
| Or, better, can we just make VALID_FOR_STATIC_INITIALIZATION_P a
| function that knows to descend into CONSTRUCTORs so we don't need a
| flag at all? It seems like potential_constant_expression might
| already be that function if you add a flag to control the special parm
| handling.
I chose a flag based on the perspective that people would start using
more and more constants of class types (and combinations with other
symbolic references), and for efficiency reason we
should just "remember" that a particular expression tree we already
processed denotes a compile time constant.
The other reason was that, I thought it is a good thing to build in a
non-circular sanity check during compile time evaluation: Basically,
during type checking we decide that a particular expression denotes a
compile time constant in a given context. Then we go off evaluating it.
If during evaluation we fail to reduce a expression to a constant
and we call again the same routine that told us that that expression is
a constant, it would not be obvious where a potential bug was.