[clang] [C11] Implement WG14 N1285 (temporary lifetimes) (PR #133472)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 1 20:49:49 PDT 2025


frederick-vs-ja wrote:

> That is unimplementable without dynamically allocating and leaking memory, which we certainly should not do and which nobody would thank us for doing.

Ah, I think [DR452](https://www.open-std.org/jtc1/sc22/wg14/issues/c11c17/issue0452.html) (adding "Such an object need not have a unique address.") also addressed this.

And then the patched C99 rule would be - the storage of the temporary object can be deallocated or reused later, but a pointer to it never becomes indeterminate. This is implementable but extremely weird, since it would indicate that some aspect of temporary objects is more persistent than that of other objects.

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


More information about the cfe-commits mailing list