[clang] Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" (PR #97308)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 7 11:57:43 PDT 2024
================
@@ -7849,13 +7854,17 @@ class Sema final : public SemaBase {
/// keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext
/// flag from previous context.
void keepInLifetimeExtendingContext() {
- if (ExprEvalContexts.size() > 2 &&
- parentEvaluationContext().InLifetimeExtendingContext) {
- auto &LastRecord = ExprEvalContexts.back();
- auto &PrevRecord = parentEvaluationContext();
- LastRecord.InLifetimeExtendingContext =
- PrevRecord.InLifetimeExtendingContext;
- }
+ if (ExprEvalContexts.size() > 2)
+ currentEvaluationContext().InLifetimeExtendingContext =
+ parentEvaluationContext().InLifetimeExtendingContext;
+ }
+
+ /// keepInRebuildDefaultArgInitContext - Pull down
+ /// RebuildDefaultArgOrDefaultInit flag from previous context.
+ void keepInRebuildDefaultArgOrInitContext() {
+ if (ExprEvalContexts.size() > 2)
+ currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
+ parentEvaluationContext().RebuildDefaultArgOrDefaultInit;
----------------
cor3ntin wrote:
Ditto
https://github.com/llvm/llvm-project/pull/97308
More information about the cfe-commits
mailing list