summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-09-29 21:28:14 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-09-29 21:28:14 +0000
commitee6311df69725a6fb5d7475a2bb3f58ceca519a9 (patch)
tree07f50361e59c8329142e874e97e972f5b21c2d1b /clang/lib/Sema
parent624784a987d11a4f6c45bf9c6d69c33c687b5f71 (diff)
downloadbcm5719-llvm-ee6311df69725a6fb5d7475a2bb3f58ceca519a9.tar.gz
bcm5719-llvm-ee6311df69725a6fb5d7475a2bb3f58ceca519a9.zip
In C++0x, static const volatile data members cannot be initialized in-class.
llvm-svn: 140809
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e56d09f6a77..d34d710cc77 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5852,12 +5852,13 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
// We allow integer constant expressions in all cases.
} else if (T->isIntegralOrEnumerationType()) {
- // FIXME: In C++0x, a non-constexpr const static data member with an
- // in-class initializer cannot be volatile.
-
// Check whether the expression is a constant expression.
SourceLocation Loc;
- if (Init->isValueDependent())
+ if (getLangOptions().CPlusPlus0x && T.isVolatileQualified())
+ // In C++0x, a non-constexpr const static data member with an
+ // in-class initializer cannot be volatile.
+ Diag(VDecl->getLocation(), diag::err_in_class_initializer_volatile);
+ else if (Init->isValueDependent())
; // Nothing to check.
else if (Init->isIntegerConstantExpr(Context, &Loc))
; // Ok, it's an ICE!
OpenPOWER on IntegriCloud