]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-data1.C
1 // { dg-do compile { target c++11 } }
2
3 // From N2235
4
5 // 1
6 struct A2
7 {
8 static const int eights = 888;
9 static constexpr int nines = 999;
10 };
11
12 A2 a;
13
14 // 2
15 struct pixel
16 {
17 int x, y;
18 };
19 constexpr pixel ur = { 1294, 1024 }; // OK
20
21 // p4
22 struct Length
23 {
24 explicit constexpr Length(int i = 0) : val(i) { }
25 private:
26 int val;
27 };
28
29 constexpr int myabs(int x)
30 { return x < 0 ? -x : x; } // OK
31
32 Length l(myabs(-97)); // OK
33
34 // p6
35 class debug_flag
36 {
37 public:
38 explicit debug_flag(bool);
39 constexpr bool is_on(); // { dg-error "enclosing class .* not a literal type" "" { target c++11_only } }
40 private:
41 bool flag;
42 };
This page took 0.039844 seconds and 5 git commands to generate.