1 // RUN: %clang_cc1 -verify %s
2 // RUN: %clang_cc1 -std=c++11 -verify %s
3 // RUN: %clang_cc1 -std=c++1y -verify %s
4 
div()5 void div() {
6   (void)(42 / 0); // expected-warning{{division by zero is undefined}}
7   (void)(42 / false); // expected-warning{{division by zero is undefined}}
8   (void)(42 / !1); // expected-warning{{division by zero is undefined}}
9   (void)(42 / (1 - 1)); // expected-warning{{division by zero is undefined}}
10   (void)(42 / !(1 + 1)); // expected-warning{{division by zero is undefined}}
11   (void)(42 / (int)(0.0)); // expected-warning{{division by zero is undefined}}
12 }
13 
rem()14 void rem() {
15   (void)(42 % 0); // expected-warning{{remainder by zero is undefined}}
16   (void)(42 % false); // expected-warning{{remainder by zero is undefined}}
17   (void)(42 % !1); // expected-warning{{remainder by zero is undefined}}
18   (void)(42 % (1 - 1)); // expected-warning{{remainder by zero is undefined}}
19   (void)(42 % !(1 + 1)); // expected-warning{{remainder by zero is undefined}}
20   (void)(42 % (int)(0.0)); // expected-warning{{remainder by zero is undefined}}
21 }
22