In C++0x, static const volatile data members cannot be initialized in-class.
llvm-svn: 140809
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e56d09f..d34d710 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5852,12 +5852,13 @@
// 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!