diff options
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4b116890fa..9c10b85ad4 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4280,7 +4280,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { if (getLangOptions().CPlusPlus) { if (!VDecl->isInvalidDecl() && !VDecl->getDeclContext()->isDependentContext() && - VDecl->hasGlobalStorage() && + VDecl->hasGlobalStorage() && !VDecl->isStaticLocal() && !Init->isConstantInitializer(Context, VDecl->getType()->isReferenceType())) Diag(VDecl->getLocation(), diag::warn_global_constructor) @@ -4492,7 +4492,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, Var->setInit(MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>())); if (getLangOptions().CPlusPlus && !Var->isInvalidDecl() && - Var->hasGlobalStorage() && + Var->hasGlobalStorage() && !Var->isStaticLocal() && !Var->getDeclContext()->isDependentContext() && !Var->getInit()->isConstantInitializer(Context, false)) Diag(Var->getLocation(), diag::warn_global_constructor); |