annotate gcc/testsuite/g++.dg/cpp0x/constexpr-type-decl1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/55250
kono
parents:
diff changeset
2 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 #define SA(X) static_assert((X),#X)
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 struct GS { constexpr operator int() { return 1; } };
kono
parents:
diff changeset
7 enum GE { y = 1 };
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 constexpr int Test1(int x) { typedef int T; return T(x) + 1; }
kono
parents:
diff changeset
10 constexpr int Test2(int x) { using T = int; return T(x) + 1; }
kono
parents:
diff changeset
11 constexpr int Test3(int x) { typedef GS T; return x + T(); }
kono
parents:
diff changeset
12 constexpr int Test4(int x) { using T = GS; return x + T(); }
kono
parents:
diff changeset
13 constexpr int Test5(int x) { typedef GE T; return x + T::y; }
kono
parents:
diff changeset
14 constexpr int Test6(int x) { using T = GE; return x + T::y; }
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 SA(Test1(2) == 3);
kono
parents:
diff changeset
17 SA(Test2(2) == 3);
kono
parents:
diff changeset
18 SA(Test3(2) == 3);
kono
parents:
diff changeset
19 SA(Test4(2) == 3);
kono
parents:
diff changeset
20 SA(Test5(2) == 3);
kono
parents:
diff changeset
21 SA(Test6(2) == 3);
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 struct S1
kono
parents:
diff changeset
24 {
kono
parents:
diff changeset
25 constexpr S1() { typedef int T; SA(T(1) == 1); }
kono
parents:
diff changeset
26 };
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 struct S2
kono
parents:
diff changeset
29 {
kono
parents:
diff changeset
30 constexpr S2() { using T = int; SA(T(1) == 1); }
kono
parents:
diff changeset
31 };
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 struct S3
kono
parents:
diff changeset
34 {
kono
parents:
diff changeset
35 constexpr S3() { typedef GS T; SA(T() == 1); }
kono
parents:
diff changeset
36 };
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 struct S4
kono
parents:
diff changeset
39 {
kono
parents:
diff changeset
40 constexpr S4() { using T = GS; SA(T() == 1); }
kono
parents:
diff changeset
41 };
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 struct S5
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 constexpr S5() { typedef GE T; SA(T::y == 1); }
kono
parents:
diff changeset
46 };
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 struct S6
kono
parents:
diff changeset
49 {
kono
parents:
diff changeset
50 constexpr S6() { using T = GE; SA(T::y == 1); }
kono
parents:
diff changeset
51 };
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 S1 s1;
kono
parents:
diff changeset
54 S2 s2;
kono
parents:
diff changeset
55 S3 s3;
kono
parents:
diff changeset
56 S4 s4;
kono
parents:
diff changeset
57 S5 s5;
kono
parents:
diff changeset
58 S6 s6;