Advanced
C++
Q91 / 100
What is the difference between deep in the compile pipeline between constexpr and consteval?
Correct! Well done.
Incorrect.
The correct answer is B) constexpr can run at compile or runtime; consteval (immediate function) must always run at compile time and produces a compile error if called at runtime
B
Correct Answer
constexpr can run at compile or runtime; consteval (immediate function) must always run at compile time and produces a compile error if called at runtime
Explanation
consteval functions are "immediate functions" — every call must produce a constant. If the argument is not a constant expression, compilation fails. constexpr may run at either time.
Progress
91/100