Alan Zhao 9b4faa11c6 [clang] Fix overly aggressive lifetime checks for parenthesized aggregate initialization
Before this patch, initialized class members would have the LifetimeKind
LK_MemInitializer, which does not allow for binding a temporary to a
reference. Binding to a temporary however is allowed in parenthesized
aggregate initialization, even if it leads to a dangling reference. To
fix this, we create a new EntityKind, EK_ParenAggInitMember, which has
LifetimeKind LK_FullExpression.

This patch does *not* attempt to diagnose dangling references as a
result of using this feature.

This patch also refactors TryOrBuildParenListInitialization(...) to
accomodate creating different InitializedEntity objects.

Fixes #61567

[0]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0960r3.html

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D148274
2023-05-01 10:02:15 -07:00
..
2022-10-22 08:05:22 +08:00
2023-03-15 08:41:45 +00:00
2022-04-04 11:32:05 -04:00
2022-11-17 16:02:54 +00:00
2023-01-18 08:51:21 -05:00
2022-07-06 07:17:47 -07:00
2022-11-21 14:20:47 -05:00
2021-10-15 16:23:04 +00:00