mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
<https://wg21.link/P2641R4>
Implements the C++26 function in `<type_traits>` [meta.const.eval] (and
the corresponding feature test macro `__cpp_lib_is_within_lifetime`)
```c++
template<class T>
consteval bool is_within_lifetime(const T*) noexcept;
```
This is done with the `__builtin_is_within_lifetime` builtin added to
Clang 20 by #91895 / 2a07509c8d. This is
not (currently) available with GCC.
This implementation has provisions for LWG4138
<https://cplusplus.github.io/LWG/issue4138> where it is ill-formed to
instantiate `is_within_lifetime<T>` with a function type `T`.
Closes #105381
Co-authored-by: Mital Ashok <mital@mitalashok.co.uk>