[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / warn-div-or-rem-by-zero.cpp
blob44b877eb1bc44c9260688b174c73f65a7be4d914
1 // RUN: %clang_cc1 -verify %s
2 // RUN: %clang_cc1 -std=c++11 -verify %s
3 // RUN: %clang_cc1 -std=c++1y -verify %s
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}}
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}}