diff options
Diffstat (limited to 'clang/lib/Analysis/ConstructionContext.cpp')
-rw-r--r-- | clang/lib/Analysis/ConstructionContext.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/ConstructionContext.cpp b/clang/lib/Analysis/ConstructionContext.cpp index aea329b1fea..1a1bc7db8fb 100644 --- a/clang/lib/Analysis/ConstructionContext.cpp +++ b/clang/lib/Analysis/ConstructionContext.cpp @@ -70,8 +70,11 @@ const ConstructionContext *ConstructionContext::createFromLayers( C.getAllocator().Allocate<TemporaryObjectConstructionContext>(); return new (CC) TemporaryObjectConstructionContext(BTE, MTE); } else if (const auto *MTE = dyn_cast<MaterializeTemporaryExpr>(S)) { + // If the object requires destruction and is not lifetime-extended, + // then it must have a BTE within its MTE. assert(MTE->getType().getCanonicalType() - ->getAsCXXRecordDecl()->hasTrivialDestructor()); + ->getAsCXXRecordDecl()->hasTrivialDestructor() || + MTE->getStorageDuration() != SD_FullExpression); assert(TopLayer->isLast()); auto *CC = C.getAllocator().Allocate<TemporaryObjectConstructionContext>(); |