diff options
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index bca560c40ae..6908b6a2b0a 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -2818,8 +2818,10 @@ StorageDuration LifetimeExtendedTemporaryDecl::getStorageDuration() const { APValue *LifetimeExtendedTemporaryDecl::getOrCreateValue(bool MayCreate) const { assert(getStorageDuration() == SD_Static && "don't need to cache the computed value for this temporary"); - if (MayCreate && !Value) + if (MayCreate && !Value) { Value = (new (getASTContext()) APValue); + getASTContext().addDestruction(Value); + } assert(Value && "may not be null"); return Value; } |

