OSDN Git Service

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