2 // { dg-do compile { target { { lp64 || ilp32 } || llp64 } } }
3 // { dg-require-effective-target c++11 }
4 // { dg-options "-O2 -Wdiv-by-zero" }
6 constexpr int sc () { return sizeof (char); }
7 constexpr int si () { return sizeof (int); }
8 constexpr int zc () { return sc () - 1; }
9 constexpr int zi (int d) { return si () / d - 1; }
14 return 1 / zc (); // { dg-warning "division by zero" }
20 constexpr int x = zc ();
21 return 1 / x; // { dg-warning "division by zero" }
27 return 1 / zi (3); // { dg-warning "division by zero" }
33 constexpr int x = zi (3);
34 return 1 / x; // { dg-warning "division by zero" }