diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-09-30 00:33:19 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-09-30 00:33:19 +0000 |
commit | 2d23ec29805f54edb3243022c64d752b8fbe5f46 (patch) | |
tree | b9b586d997798ddb569da42873b5c0f9d9f7fba4 /lib/Sema/SemaDecl.cpp | |
parent | 947be1941e9a1d4233116f51a45799d3904d4231 (diff) |
Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 7bb3aa1511..3ba9464cb1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5879,6 +5879,10 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } else if (T->isFloatingType()) { // also permits complex, which is ok Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type) << T << Init->getSourceRange(); + if (getLangOptions().CPlusPlus0x) + Diag(VDecl->getLocation(), + diag::note_in_class_initializer_float_type_constexpr) + << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); if (!Init->isValueDependent() && !Init->isConstantInitializer(Context, false)) { |