Richard Smith | 2316cd8 | 2011-09-29 19:11:37 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s |
| 2 | |
| 3 | struct NonLit { |
| 4 | NonLit(); |
| 5 | }; |
| 6 | |
| 7 | struct S { |
| 8 | static constexpr int a = 0; |
| 9 | static constexpr int b; // expected-error {{declaration of constexpr variable 'b' requires an initializer}} |
| 10 | |
| 11 | static constexpr int c = 0; |
| 12 | static const int d; |
| 13 | |
| 14 | static constexpr double e = 0.0; // ok |
| 15 | static const double f = 0.0; // expected-warning {{accepted as an extension}} |
| 16 | static char *const g = 0; // expected-warning {{accepted as an extension}} |
| 17 | static const NonLit h = NonLit(); // expected-error {{must be initialized out of line}} |
| 18 | }; |
| 19 | |
| 20 | constexpr int S::a; // expected-error {{definition of initialized static data member 'a' cannot be marked constexpr}} |
| 21 | constexpr int S::b = 0; |
| 22 | |
| 23 | const int S::c; |
| 24 | constexpr int S::d = 0; |