1/* RUN: %clang_cc1 -E %s -DNO_ERRORS -Werror -Wundef
2   RUN: not %clang_cc1 -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
13foo
14#endif
15
16#if MACRO_1 || 10 / MACRO_0
17bar
18#endif
19
20#if 0 ? 124/0 : 42
21#endif
22
23// PR2279
24#if 0 ? 1/0: 2
25#else
26#error
27#endif
28
29// PR2279
30#if 1 ? 2 ? 3 : 4 : 5
31#endif
32
33// PR2284
34#if 1 ? 0: 1 ? 1/0: 1/0
35#endif
36
37#else
38
39
40/* The 1/0 is live, it should error out. */
41#if 0 && 1 ? 4 : 1 / 0
42baz
43#endif
44
45
46#endif
47
48// rdar://6505352
49// -Wundef should not warn about use of undefined identifier if not live.
50#if (!defined(XXX) || XXX > 42)
51#endif
52
53