p3.cpp revision 2d23ec29805f54edb3243022c64d752b8fbe5f46
1// 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 {{extension}} expected-note {{use 'constexpr' specifier}}
16  static char *const g = 0; // expected-error {{requires 'constexpr' specifier}}
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;
25