111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 // From N2235
|
|
4
|
|
5 // 4.5.2 semantics
|
|
6
|
|
7 // p 1 constexpr specifier
|
|
8 // objects, static const data
|
|
9 struct A1 { int i; }; // { dg-message "no user-provided default constructor" }
|
|
10
|
|
11 constexpr int i1 = 1024;
|
|
12 constexpr A1 a1 = A1();
|
|
13
|
|
14 // error: not a definition
|
|
15 extern constexpr int i2; // { dg-error "definition" }
|
|
16
|
|
17 // error: missing initializer
|
145
|
18 constexpr A1 a2; // { dg-error "uninitialized 'const" }
|
111
|
19
|
|
20 const constexpr A1 a3 = A1();
|
|
21
|
|
22 volatile constexpr A1 a4 = A1(); // { dg-bogus "both .volatile. and .constexpr. cannot" }
|
|
23
|
|
24 // error: on type declaration
|
|
25 constexpr struct pixel // { dg-error "cannot be used for type declarations" }
|
|
26 {
|
|
27 int x;
|
|
28 int y;
|
|
29 };
|