[clang] [C11] Implement WG14 N1285 (temporary lifetimes) (PR #133472)
James Y Knight via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 31 15:42:45 PDT 2025
jyknight wrote:
- In C89: it's impossible to get the address of a temporary struct, so the lifetime is irrelevant.
- In C99: you now can get the address (from an array subobject), but the lifetime was defined as "until the next sequence point". This made it technically illegal to access even non-array subobjects from a temporary struct in many cases where it seems like it should be fine and was in C89.
- In C11, the lifetime was _extended_ to be the containing full expression.
(LMK if I've got that wrong!) Given that, how is the C11 change a breaking change? It seems like the C99 rule was just bogus, and we should forget it ever existed?
https://github.com/llvm/llvm-project/pull/133472
More information about the cfe-commits
mailing list