aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/class
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-10-06 09:21:12 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-10-06 09:21:12 +0000
commitb52c0dddffdb27b3a058913020001afcfc937d8d (patch)
tree0b40e0b74ba37112b27aa2fc32a4c920ce2e5284 /test/CXX/class
parentd12059673dcef32bc2b6bae5321654d33863afe6 (diff)
PR11067: A definition of a constexpr static variable doesn't need an initializer if the in-class declaration had one. Such a declaration must be initialized by a constant expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/class')
-rw-r--r--test/CXX/class/class.static/class.static.data/p3.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/CXX/class/class.static/class.static.data/p3.cpp b/test/CXX/class/class.static/class.static.data/p3.cpp
index 031c376648..82460c5d96 100644
--- a/test/CXX/class/class.static/class.static.data/p3.cpp
+++ b/test/CXX/class/class.static/class.static.data/p3.cpp
@@ -10,6 +10,7 @@ struct S {
static constexpr int c = 0;
static const int d;
+ static const int d2 = 0;
static constexpr double e = 0.0; // ok
static const double f = 0.0; // expected-warning {{extension}} expected-note {{use 'constexpr' specifier}}
@@ -17,8 +18,9 @@ struct S {
static const NonLit h = NonLit(); // expected-error {{must be initialized out of line}}
};
-constexpr int S::a; // expected-error {{definition of initialized static data member 'a' cannot be marked constexpr}}
+constexpr int S::a;
constexpr int S::b = 0;
const int S::c;
constexpr int S::d = 0;
+constexpr int S::d2;