aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
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
commit2da7a51270a5f40e88d07750ebdadd774368b9f4 (patch)
tree5fd02caf22b3ca1a7f30d1216e5834b75d96595e /lib/Sema/SemaDecl.cpp
parent1991b7139a92d73420336690a870f049e88cfad6 (diff)
In C++0x, static const volatile data members cannot be initialized in-class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index e56d09f6a7..d34d710cc7 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/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!