| 1 |
/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. */ |
| 2 |
|
| 3 |
/* { dg-do preprocess } */ |
| 4 |
/* { dg-additional-options "-Wall" } */ |
| 5 |
|
| 6 |
/* Test we get signedness of ?: operator correct. We would skip |
| 7 |
evaluation of one argument, and might therefore not transfer its |
| 8 |
unsignedness to the result. */ |
| 9 |
|
| 10 |
/* Neil Booth, 19 Jul 2002. */ |
| 11 |
|
| 12 |
#if (1 ? -2: 0 + 1U) < 0 /* { dg-warning {the left operand of ':' changes sign} } */ |
| 13 |
#error /* { dg-bogus "error" } */ |
| 14 |
#endif |
| 15 |
|
| 16 |
#if (0 ? 0 + 1U: -2) < 0 /* { dg-warning {the right operand of ':' changes sign} } */ |
| 17 |
#error /* { dg-bogus "error" } */ |
| 18 |
#endif |
| 19 |
|
| 20 |
/* PR preprocessor/112701 */ |
| 21 |
#if (0 ? 0/0u : -1) < 0 /* { dg-warning {the right operand of ':' changes sign} } */ |
| 22 |
#error /* { dg-bogus "error" } */ |
| 23 |
#endif |
| 24 |
|
| 25 |
#if (0 ? 0u/0 : -1) < 0 /* { dg-warning {the right operand of ':' changes sign} } */ |
| 26 |
#error /* { dg-bogus "error" } */ |
| 27 |
#endif |
| 28 |
|
| 29 |
#if (1 ? -1 : 0/0u) < 0 /* { dg-warning {the left operand of ':' changes sign} } */ |
| 30 |
#error /* { dg-bogus "error" } */ |
| 31 |
#endif |
| 32 |
|
| 33 |
#if (1 ? -1 : 0u/0) < 0 /* { dg-warning {the left operand of ':' changes sign} } */ |
| 34 |
#error /* { dg-bogus "error" } */ |
| 35 |
#endif |