111
|
1 // { dg-do compile { target c++11 } }
|
|
2
|
|
3 constexpr int
|
|
4 fn1 (int i, int j)
|
|
5 {
|
|
6 return i << j; // { dg-error "is negative" }
|
|
7 }
|
|
8
|
131
|
9 constexpr int i1 = fn1 (1, -1); // { dg-message "in .constexpr. expansion of " }
|
111
|
10
|
|
11 constexpr int
|
|
12 fn2 (int i, int j)
|
|
13 {
|
145
|
14 return i << j; // { dg-error "is greater than or equal to the precision .. of the left operand" }
|
111
|
15 }
|
|
16
|
131
|
17 constexpr int i2 = fn2 (1, 200); // { dg-message "in .constexpr. expansion of " }
|
111
|
18
|
|
19 constexpr int
|
|
20 fn3 (int i, int j)
|
|
21 {
|
145
|
22 return i << j; // { dg-error "is negative" "" { target c++17_down } }
|
111
|
23 }
|
|
24
|
145
|
25 constexpr int i3 = fn3 (-1, 2); // { dg-message "in .constexpr. expansion of " "" { target c++17_down } }
|
111
|
26
|
|
27 constexpr int
|
|
28 fn4 (int i, int j)
|
|
29 {
|
145
|
30 return i << j; // { dg-error "overflows" "" { target c++17_down } }
|
111
|
31 }
|
|
32
|
145
|
33 constexpr int i4 = fn4 (__INT_MAX__, 2); // { dg-message "in .constexpr. expansion of " "" { target c++17_down } }
|
111
|
34
|
|
35 constexpr int
|
|
36 fn5 (int i, int j)
|
|
37 {
|
|
38 return i << j;
|
|
39 }
|
|
40
|
|
41 constexpr int i5 = fn5 (__INT_MAX__, 1);
|
|
42
|
|
43 constexpr int
|
|
44 fn6 (unsigned int i, unsigned int j)
|
|
45 {
|
145
|
46 return i << j; // { dg-error "is greater than or equal to the precision .. of the left operand" }
|
111
|
47 }
|
|
48
|
131
|
49 constexpr int i6 = fn6 (1, -1); // { dg-message "in .constexpr. expansion of " }
|
111
|
50
|
|
51 constexpr int
|
|
52 fn7 (int i, int j)
|
|
53 {
|
|
54 return i >> j; // { dg-error "is negative" }
|
|
55 }
|
|
56
|
131
|
57 constexpr int i7 = fn7 (1, -1); // { dg-message "in .constexpr. expansion of " }
|
111
|
58
|
|
59 constexpr int
|
|
60 fn8 (int i, int j)
|
|
61 {
|
|
62 return i >> j;
|
|
63 }
|
|
64
|
|
65 constexpr int i8 = fn8 (-1, 1);
|
|
66
|
|
67 constexpr int
|
|
68 fn9 (int i, int j)
|
|
69 {
|
145
|
70 return i >> j; // { dg-error "is greater than or equal to the precision .. of the left operand" }
|
111
|
71 }
|
|
72
|
131
|
73 constexpr int i9 = fn9 (1, 200); // { dg-message "in .constexpr. expansion of " }
|