blob: 72dbec771ae1ca539ea7a1a02dcb8aa29040f1bf [file] [log] [blame]
Richard Smith2316cd82011-09-29 19:11:37 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
2
3struct NonLit {
4 NonLit();
5};
6
7struct 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
20constexpr int S::a; // expected-error {{definition of initialized static data member 'a' cannot be marked constexpr}}
21constexpr int S::b = 0;
22
23const int S::c;
24constexpr int S::d = 0;