Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/constexpr-data1.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 }; |