PR c++/85765 - SFINAE and non-type default template arg.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-shift1.C
blob4abd9e0cfb6bf6e15a49971f6959e906bcab3828
1 // { dg-do compile { target c++11 } }
3 constexpr int
4 fn1 (int i, int j)
6   return i << j; // { dg-error "is negative" }
9 constexpr int i1 = fn1 (1, -1); // { dg-message "in .constexpr. expansion of " }
11 constexpr int
12 fn2 (int i, int j)
14   return i << j; // { dg-error "is >= than the precision of the left operand" }
17 constexpr int i2 = fn2 (1, 200); // { dg-message "in .constexpr. expansion of " }
19 constexpr int
20 fn3 (int i, int j)
22   return i << j; // { dg-error "is negative" }
25 constexpr int i3 = fn3 (-1, 2); // { dg-message "in .constexpr. expansion of " }
27 constexpr int
28 fn4 (int i, int j)
30   return i << j; // { dg-error "overflows" }
33 constexpr int i4 = fn4 (__INT_MAX__, 2); // { dg-message "in .constexpr. expansion of " }
35 constexpr int
36 fn5 (int i, int j)
38   return i << j;
41 constexpr int i5 = fn5 (__INT_MAX__, 1);
43 constexpr int
44 fn6 (unsigned int i, unsigned int j)
46   return i << j; // { dg-error "is >= than the precision of the left operand" }
49 constexpr int i6 = fn6 (1, -1); // { dg-message "in .constexpr. expansion of " }
51 constexpr int
52 fn7 (int i, int j)
54   return i >> j; // { dg-error "is negative" }
57 constexpr int i7 = fn7 (1, -1); // { dg-message "in .constexpr. expansion of " }
59 constexpr int
60 fn8 (int i, int j)
62   return i >> j;
65 constexpr int i8 = fn8 (-1, 1);
67 constexpr int
68 fn9 (int i, int j)
70   return i >> j;  // { dg-error "is >= than the precision of the left operand" }
73 constexpr int i9 = fn9 (1, 200); // { dg-message "in .constexpr. expansion of " }