FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.warn / compare1.C
blob687d98661e441e2c922d594bbca862fa7b81340f
1 // Build don't link:
2 // Special g++ Options: -ansi -pedantic-errors -Wsign-compare
4 // Copyright (C) 2001 Free Software Foundation, Inc.
5 // Contributed by Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 5/13/2001
7 int foo(int x, int y, unsigned u)
9   /* A MAX_EXPR is non-negative if EITHER argument to the MAX_EXPR is
10      determined to be non-negative.  */
11   if (u < (x >? -1)) // WARNING - signed and unsigned
12     return x;
13   if (u < (x >? 10))
14     return x;
15   if ((10 >? x) < u)
16     return x;
17   if (u < (x >? (y ? (x==y) : 10)))
18     return x;
19   if (((y ? 10 : (x==y)) >? x) < u)
20     return x;
22   /* A MIN_EXPR is non-negative if BOTH arguments to the MIN_EXPR are
23      determined to be non-negative.  */
24   if (u < ((x?11:8) <? -1)) // WARNING - signed and unsigned
25     return x;
26   if (u < ((x?11:8) <? 10))
27     return x;
28   if ((10 <? (x?8:11)) < u)
29     return x;
30   if (u < ((x?11:(x==y)) <? 10))
31     return x;
32   if ((10 <? (x?(x==y):11)) < u)
33     return x;
35   return 0;