This patch implements __builtin_is_constant_evaluated as specifier by P0595R2. It is built on the back of Bill Wendling's work for __builtin_constant_p().
More tests to come, but early feedback is appreciated.
I plan to implement warnings for common mis-usages like those belowe in a following patch:
void foo(int x) { if constexpr (std::is_constant_evaluated())) { // condition is always `true`. Should use plain `if` instead. foo_constexpr(x); } else { foo_runtime(x); } }
This should be grouped with __builtin_launder, though maybe moving that one here makes more sense than grouping them both under "GCC builtins" since they're directly implementing C++ stdlib functions.