Why does a consteval function allow undefined behavior?
问题 There is a very neat property of constant expressions in C++: their evaluation cannot have undefined behavior (7.7.4.7): An expression e is a core constant expression unless the evaluation of e, following the rules of the abstract machine ([intro.execution]), would evaluate one of the following: ... an operation that would have undefined behavior as specified in [intro] through [cpp] of this document [ Note: including, for example, signed integer overflow ([expr.prop]), certain pointer