[Bug c++/79452] Provide builtin to detect compile-time execution

2021-12-07 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #12 from Jonathan Wakely --- Well this request is satisfied by std::is_constant_evaluated() in C++20, which is what __builtin_is_constant_evaluated() exists for. PR 100974 adds a newer C++23 language feature that makes std::is_constan

[Bug c++/79452] Provide builtin to detect compile-time execution

2021-12-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-13 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 Markus Trippelsdorf changed: What|Removed |Added CC||trippels at gcc dot gnu.org --- Co

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-11 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #9 from Eric Fiselier --- I think it would be nice to be able to dispatch differently depending on being called at compile time or runtime. However the ability to dispatch on that condition doesn't have to be usable in "if constexpr".

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-11 Thread gonzalobg88 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #8 from gnzlbg --- Eric your concerns and suggestions make sense. Changing the signature of the functions using something like __ctfe__ and probably anything that would use those sounds like a major ABI breaking change though. I do no

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 Eric Fiselier changed: What|Removed |Added CC||eric at efcs dot ca --- Comment #7 from

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread gonzalobg88 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #6 from gnzlbg --- > I wasn't replying to the part about function aliases, I was replying to the > part about having the built-in work even when used in a non-constexpr > function. It sounds like what you're suggesting would depend

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #5 from Andrew Pinski --- What about __builtin_constant_expression.

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #4 from Jonathan Wakely --- (In reply to gnzlbg from comment #2) > if constexpr() { // Error: expression missing in if condition Oh, I didn't realise you meant without an expression. Yeah that doesn't work. > > That sounds like a

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread gonzalobg88 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #3 from gnzlbg --- I guess I should have written, "How does this feature make ODR violations more common than the inline keyword?". Which new perils does it introduce?

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread gonzalobg88 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #2 from gnzlbg --- > It's already in C++17 and supported by GCC. The following program is ill-formed in C++17: int main() { if constexpr() { // Error: expression missing in if condition return 1; } return 0; } > That s

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 Jonathan Wakely changed: What|Removed |Added Severity|normal |enhancement

[Bug c++/79452] Provide builtin to detect compile-time execution

2017-02-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79452 --- Comment #1 from Jonathan Wakely --- (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 su