From 2ae28e57a2d5e3456171fa1ade37060169583e38 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 24 Sep 2013 23:10:08 +0000 Subject: [PATCH] Fix -Wmissing-variable-declarations regression. This issue was introduced in r181677. PR17349. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191339 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDecl.cpp | 2 +- test/SemaCXX/warn-missing-variable-declarations.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 92400df00c..fa51aa4c09 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8683,7 +8683,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { } if (var->isThisDeclarationADefinition() && - var->isExternallyVisible() && + var->isExternallyVisible() && var->hasLinkage() && getDiagnostics().getDiagnosticLevel( diag::warn_missing_variable_declarations, var->getLocation())) { diff --git a/test/SemaCXX/warn-missing-variable-declarations.cpp b/test/SemaCXX/warn-missing-variable-declarations.cpp index 12af9735d1..ad23e0429b 100644 --- a/test/SemaCXX/warn-missing-variable-declarations.cpp +++ b/test/SemaCXX/warn-missing-variable-declarations.cpp @@ -41,3 +41,9 @@ int CGood1::MGood1; namespace { int mgood4; } + +class C { + void test() { + static int x = 0; // no-warn + } +}; -- 2.40.0