[clang] [Clang] Add __builtin_is_within_lifetime to implement P2641R4's std::is_within_lifetime (PR #91895)
Mital Ashok via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 12 14:01:12 PDT 2024
MitalAshok wrote:
Hmm. On reading https://eel.is/c++draft/meta.const.eval#4 again, it says:
> *Remarks*: During the evaluation of an expression `E` as a core constant expression, a call to this function is ill-formed unless `p` points to an object that is usable in constant expressions or whose complete object's lifetime began within `E`.
So calling it inside constructors before the complete-object's lifetime has began (<https://eel.is/c++draft/basic.life#1.2>) should be ill-formed (instead of the current behaviour of `false`)
But I'm unsure about dangling pointers. The complete object's lifetime had begun, but it also ended. And https://cplusplus.github.io/CWG/issues/2822.html seems to make it implementation defined to use the pointer
https://github.com/llvm/llvm-project/pull/91895
More information about the cfe-commits
mailing list