diff options
Diffstat (limited to 'test/CXX/class/class.static/class.static.data/p3.cpp')
-rw-r--r-- | test/CXX/class/class.static/class.static.data/p3.cpp | 15 |
1 files changed, 12 insertions, 3 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 1607bac80293f..413017d133518 100644 --- a/test/CXX/class/class.static/class.static.data/p3.cpp +++ b/test/CXX/class/class.static/class.static.data/p3.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s struct NonLit { // expected-note 3{{no constexpr constructors}} NonLit(); @@ -6,7 +7,7 @@ struct NonLit { // expected-note 3{{no constexpr constructors}} struct S { static constexpr int a = 0; - static constexpr int b; // expected-error {{declaration of constexpr static data member 'b' requires an initializer}} + static constexpr int b; // expected-error {{initializ}} expected-note 0-1{{previous}} static constexpr int c = 0; static const int d; @@ -16,19 +17,27 @@ struct S { static const double f = 0.0; // expected-error {{requires 'constexpr' specifier}} expected-note {{add 'constexpr'}} static char *const g = 0; // expected-error {{requires 'constexpr' specifier}} static const NonLit h = NonLit(); // expected-error {{must be initialized out of line}} + + static inline int i; // expected-note {{previous}} expected-warning 0-1{{extension}} + static inline int j; // expected-note {{previous}} expected-warning 0-1{{extension}} + static constexpr int k = 0; }; constexpr int S::a; -constexpr int S::b = 0; +constexpr int S::b = 0; // expected-error 0-1{{redefinition}} const int S::c; constexpr int S::d = 0; constexpr int S::d2; +int S::i; // expected-error {{redefinition}} +int S::j; // expected-error {{redefinition}} +const int S::k; // ok (deprecated) + template<typename T> struct U { static constexpr int a = 0; - static constexpr int b; // expected-error {{declaration of constexpr static data member 'b' requires an initializer}} + static constexpr int b; // expected-error {{initializ}} static constexpr NonLit h = NonLit(); // expected-error {{cannot have non-literal type 'const NonLit'}} static constexpr T c = T(); // expected-error {{cannot have non-literal type}} static const T d; |