the initializer of a variable
that is usable in constant expressions or
has constant initialization ([basic.start.static]).65
[Example 1: template<bool>struct X {};
X<std::is_constant_evaluated()> x; // type X<true>int y;
constint a = std::is_constant_evaluated()? y :1; // dynamic initialization to 1double z[a]; // error: a is not usable// in constant expressionsconstint b = std::is_constant_evaluated()?2: y; // static initialization to 2int c = y +(std::is_constant_evaluated()?2: y); // dynamic initialization to y+yconstexprint f(){constint n = std::is_constant_evaluated()?13:17; // n is 13int m = std::is_constant_evaluated()?13:17; // m can be 13 or 17 (see below)char arr[n]={}; // char[13]return m +sizeof(arr);
}int p = f(); // m is 13; initialized to 26int q = p + f(); // m is 17 for this call; initialized to 56 — end example]
it is of class type or (possibly multidimensional) array thereof,
that class type has a constexpr destructor ([dcl.constexpr]), and
for a hypothetical expression E
whose only effect is to destroy a,
E would be a core constant expression
if the lifetime of a and its non-mutable subobjects
(but not its mutable subobjects) were considered to start within E.
Testing this condition
can involve a trial evaluation of its initializer,
with evaluations of contract assertions
using the ignore evaluation semantic ([basic.contract.eval]),
as described above.