[clang] [Clang] Add attribute for consteval builtins; Declare constexpr builtins as constexpr in C++ (PR #91894)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Sun May 12 12:12:51 PDT 2024


MitalAshok wrote:

Currently, GCC's behaviour for builtin function redeclarations is to just ignore `constexpr`: <https://godbolt.org/z/e9jzjjrax>. This is slightly stricter, allowing non-`constexpr` redeclarations for `constexpr` builtins but still disallowing `constexpr` declarations for non-`constexpr` builtins.

[P2641R4 `std::is_within_lifetime`](https://wg21.link/P2641R4) is most likely going to be implemented as a `consteval` builtin, which the attribute allows implementing easily as a builtin-function with `getConstexprKind() == ConstexprSpecKind::Consteval`.

https://github.com/llvm/llvm-project/pull/91894


More information about the cfe-commits mailing list