[Bug c++/79452] Provide builtin to detect compile-time execution
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 10 11:43:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to gnzlbg from comment #0)
> Implementation as a builtin is preferred, because it is possible that "if
> constexpr() { }" syntax will be proposed for standardization.
It's already in C++17 and supported by GCC.
> I'd rather have this built-in always work. That is, even if its invoked
> inside a non-constexpr function, it might still be that some block inside
> that function is evaluated by the constant expression evaluator of the C++
> compiler. The built-in should detect this case properly.
That sounds like a recipe for ODR violations.
More information about the Gcc-bugs
mailing list