aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/expr.c
blob: d08cb0ceb535377e5f40b775a66cf85c27b93726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.  */

/* { dg-do preprocess } */
/* { dg-additional-options "-Wall" } */

/* Test we get signedness of ?: operator correct.  We would skip
   evaluation of one argument, and might therefore not transfer its
   unsignedness to the result.  */

/* Neil Booth, 19 Jul 2002.  */

#if (1 ? -2: 0 + 1U) < 0 /* { dg-warning {the left operand of ':' changes sign} } */
#error				/* { dg-bogus "error" } */
#endif

#if (0 ? 0 + 1U: -2) < 0 /* { dg-warning {the right operand of ':' changes sign} } */
#error				/* { dg-bogus "error" } */
#endif

/* PR preprocessor/112701 */
#if (0 ? 0/0u : -1) < 0 /* { dg-warning {the right operand of ':' changes sign} } */
#error /* { dg-bogus "error" } */
#endif

#if (0 ? 0u/0 : -1) < 0 /* { dg-warning {the right operand of ':' changes sign} } */
#error /* { dg-bogus "error" } */
#endif

#if (1 ? -1 : 0/0u) < 0 /* { dg-warning {the left operand of ':' changes sign} } */
#error /* { dg-bogus "error" } */
#endif

#if (1 ? -1 : 0u/0) < 0 /* { dg-warning {the left operand of ':' changes sign} } */
#error /* { dg-bogus "error" } */
#endif