Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C

raw
1 // PR c++/48911
2 // { dg-do compile { target c++11 } }
3
4 #define SA(X) static_assert((X),#X)
5
6 struct A
7 {
8 constexpr A () : a (6) {}
9 int a;
10 };
11
12 int
13 main ()
14 {
15 constexpr int a[2] = { 42 };
16 constexpr int i = a[1];
17 SA(i==0);
18 constexpr int b[1] = { };
19 constexpr int j = b[0];
20 SA(j==0);
21 constexpr char c[2] = "a";
22 constexpr char k = c[1];
23 SA(k==0);
24 constexpr char d[2] = "";
25 constexpr char l = d[1];
26 SA(l==0);
27 constexpr wchar_t e[2] = L"a";
28 constexpr wchar_t m = e[1];
29 SA(m==0);
30 constexpr wchar_t f[2] = L"";
31 constexpr wchar_t n = f[1];
32 SA(n==0);
33 constexpr A g[2] = { A () };
34 constexpr A o = g[0];
35 SA(o.a == 6);
36 constexpr A p = g[1];
37 SA(p.a == 6);
38 }