const-vs-constexpr-on-variables
What the guy says about constexpr is right if double
is used (or float
of course). However, if you change t
From the comments it seems like OP is asking for Standard quote which defines const int
as a compile-time constant, but const double
as not.
The corresponding details are found in 5.19, Constant Expressions
. In particular:
...an lvalue-to-rvalue conversion (4.1) unless it is applied to a non-volatile glvalue of integral or enumeration type that refers to a non-volatile const object with a preceding initialization, initialized with a constant expression...
int
is an integral type, while double
is not.