summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-01-29 21:40:37 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-01-29 21:40:37 +0000
commit3645cf99f234e9d2c03014551027e2c47e1d2c1e (patch)
tree785f574f2043f3573c0c5f068411fd37d81855ff /clang/lib/Sema/SemaDecl.cpp
parent386241ce5b1fe86a1ad19039c9dfe4ccabe97e95 (diff)
downloadbcm5719-llvm-3645cf99f234e9d2c03014551027e2c47e1d2c1e.tar.gz
bcm5719-llvm-3645cf99f234e9d2c03014551027e2c47e1d2c1e.zip
Don't fixit/recover from -Wstatic-float-init when it's not an error.
Fix to change r173414 that lead to Clang changing const to constexpr even under -Wno-static-float-init. llvm-svn: 173835
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 33506401cfe..702d38280a6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7203,11 +7203,15 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
// In C++98, this is a GNU extension. In C++11, it is not, but we support
// it anyway and provide a fixit to add the 'constexpr'.
if (getLangOpts().CPlusPlus11) {
- Diag(VDecl->getLocation(),
- diag::ext_in_class_initializer_float_type_cxx11)
- << DclT << Init->getSourceRange()
- << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr ");
- VDecl->setConstexpr(true);
+ SemaDiagnosticBuilder D = Diag(VDecl->getLocation(),
+ diag::ext_in_class_initializer_float_type_cxx11);
+ D << DclT << Init->getSourceRange();
+ if (Diags.getDiagnosticLevel(diag::warn_initializer_out_of_order,
+ VDecl->getLocation()) >=
+ DiagnosticsEngine::Error) {
+ D << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr ");
+ VDecl->setConstexpr(true);
+ }
} else {
Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type)
<< DclT << Init->getSourceRange();
OpenPOWER on IntegriCloud