Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 | |
9 constexpr int i1 = fn1 (1, -1); | |
10 | |
11 constexpr int | |
12 fn2 (int i, int j) | |
13 { | |
14 return i << j; // { dg-error "is >= than the precision of the left operand" } | |
15 } | |
16 | |
17 constexpr int i2 = fn2 (1, 200); | |
18 | |
19 constexpr int | |
20 fn3 (int i, int j) | |
21 { | |
22 return i << j; // { dg-error "is negative" } | |
23 } | |
24 | |
25 constexpr int i3 = fn3 (-1, 2); | |
26 | |
27 constexpr int | |
28 fn4 (int i, int j) | |
29 { | |
30 return i << j; // { dg-error "overflows" } | |
31 } | |
32 | |
33 constexpr int i4 = fn4 (__INT_MAX__, 2); | |
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 { | |
46 return i << j; // { dg-error "is >= than the precision of the left operand" } | |
47 } | |
48 | |
49 constexpr int i6 = fn6 (1, -1); | |
50 | |
51 constexpr int | |
52 fn7 (int i, int j) | |
53 { | |
54 return i >> j; // { dg-error "is negative" } | |
55 } | |
56 | |
57 constexpr int i7 = fn7 (1, -1); | |
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 { | |
70 return i >> j; // { dg-error "is >= than the precision of the left operand" } | |
71 } | |
72 | |
73 constexpr int i9 = fn9 (1, 200); |