diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-09-29 23:18:34 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-09-29 23:18:34 +0000 |
commit | 256336d9ab6dc277df8c49704e9900146cea7f69 (patch) | |
tree | a759775273ec4c903d8157bbe29d5ba1f5c070be /clang/lib/Sema/SemaDecl.cpp | |
parent | 82d4a2b91f3fe7ae5937e361aba1df1b882c3de2 (diff) | |
download | bcm5719-llvm-256336d9ab6dc277df8c49704e9900146cea7f69.tar.gz bcm5719-llvm-256336d9ab6dc277df8c49704e9900146cea7f69.zip |
Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.
llvm-svn: 140820
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d34d710cc77..7bb3aa15110 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5875,13 +5875,6 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, VDecl->setInvalidDecl(); } - // Suggest adding 'constexpr' in C++0x for literal types. - } else if (getLangOptions().CPlusPlus0x && T->isLiteralType()) { - Diag(VDecl->getLocation(), diag::ext_in_class_initializer_literal_type) - << T << Init->getSourceRange() - << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); - VDecl->setConstexpr(true); - // We allow floating-point constants as an extension. } else if (T->isFloatingType()) { // also permits complex, which is ok Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type) @@ -5893,6 +5886,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, << Init->getSourceRange(); VDecl->setInvalidDecl(); } + + // Suggest adding 'constexpr' in C++0x for literal types. + } else if (getLangOptions().CPlusPlus0x && T->isLiteralType()) { + Diag(VDecl->getLocation(), diag::err_in_class_initializer_literal_type) + << T << Init->getSourceRange() + << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); + VDecl->setConstexpr(true); + } else { Diag(VDecl->getLocation(), diag::err_in_class_initializer_bad_type) << T << Init->getSourceRange(); |