OSDN Git Service

* call.c (null_ptr_cst_p): Use maybe_constant_value.
[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 { };     // { 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 // error: duplicate cv
22 const constexpr A1 a3 = A1(); // { dg-error "both .const. and .constexpr. cannot" }
23
24 volatile constexpr A1 a4 = A1(); // { dg-error "both .volatile. and .constexpr. cannot" }
25
26 // error: on type declaration
27 constexpr struct pixel
28 {
29   int x;
30   int y;
31 };                   // { dg-error "cannot be used for type declarations" }