summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 28f49d07986..1415f73f644 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3727,7 +3727,8 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
if (Init.isInvalid())
Var->setInvalidDecl();
else {
- Var->setInit(Context,
+ if (Init.get())
+ Var->setInit(Context,
MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>()));
FinalizeVarWithDestructor(Var, InitType->getAs<RecordType>());
}
OpenPOWER on IntegriCloud