diff options
author | John McCall <rjmccall@apple.com> | 2011-02-21 19:25:48 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-21 19:25:48 +0000 |
commit | 77efc680156bc28d3c0d2e70f156904f91328b21 (patch) | |
tree | 8b8c664a9b87d8730c83ae11cb05f905da2d8af2 /lib/Sema/SemaExpr.cpp | |
parent | 6c6b0ebc33c4db48355078a45a21cb6867e298b1 (diff) |
Don't warn about static const integral data members with in-line constant
initializers just because they don't have a proper out-of-line definition.
Such code is technically ill-formed but is too common and too unlikely to be
a problem to be seriously worth worrying about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 84baa7d985..e7d167ed38 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -9336,9 +9336,12 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) { } } - // Keep track of used but undefined variables. + // Keep track of used but undefined variables. We make a hole in + // the warning for static const data members with in-line + // initializers. if (Var->hasDefinition() == VarDecl::DeclarationOnly - && Var->getLinkage() != ExternalLinkage) { + && Var->getLinkage() != ExternalLinkage + && !(Var->isStaticDataMember() && Var->hasInit())) { SourceLocation &old = UndefinedInternals[Var->getCanonicalDecl()]; if (old.isInvalid()) old = Loc; } |