Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++constexpr consteval constinitSingle-choice MCQ

What is the key semantic difference that makes `consteval` strictly stronger than `constexpr` for the function `sqr` below, in terms of what the compiler is required to do?

consteval int sqr(int x) { return x * x; } int r = sqr(7); // OK // int q = sqr(read()); // ill-formed: read() is not constant