Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 1 | /* RUN: clang -E %s -DNO_ERRORS && |
| 2 | RUN: not clang -E %s |
| 3 | */ |
| 4 | |
| 5 | #ifdef NO_ERRORS |
| 6 | /* None of these divisions by zero are in live parts of the expression, do not |
| 7 | emit any diagnostics. */ |
| 8 | |
| 9 | #define MACRO_0 0 |
| 10 | #define MACRO_1 1 |
| 11 | |
| 12 | #if MACRO_0 && 10 / MACRO_0 |
| 13 | foo |
| 14 | #endif |
| 15 | |
| 16 | #if MACRO_1 || 10 / MACRO_0 |
| 17 | bar |
| 18 | #endif |
| 19 | |
| 20 | #if 0 ? 124/0 : 42 |
| 21 | #endif |
| 22 | |
Chris Lattner | 89c3331 | 2008-05-04 07:15:21 +0000 | [diff] [blame] | 23 | // PR2279 |
| 24 | #if 0 ? 1/0: 2 |
| 25 | #else |
| 26 | #error |
| 27 | #endif |
| 28 | |
| 29 | |
Chris Lattner | 4b00965 | 2007-07-25 00:24:17 +0000 | [diff] [blame] | 30 | #else |
| 31 | |
| 32 | |
| 33 | /* The 1/0 is live, it should error out. */ |
| 34 | #if 0 && 1 ? 4 : 1 / 0 |
| 35 | baz |
| 36 | #endif |
| 37 | |
| 38 | |
| 39 | #endif |