OSDN Git Service

PR tree-optimization/15262
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / builtin-types-compatible-p.c
1 int i;
2 double d;
3
4 /* Make sure we return a constant.  */
5 float rootbeer[__builtin_types_compatible_p (int, typeof(i))];
6
7 typedef enum { hot, dog, poo, bear } dingos;
8 typedef enum { janette, laura, amanda } cranberry;
9
10 typedef float same1;
11 typedef float same2;
12
13 int main (void);
14
15 int main (void)
16 {
17   /* Compatible types.  */
18   if (!(__builtin_types_compatible_p (int, const int)
19         && __builtin_types_compatible_p (typeof (hot), int)
20         && __builtin_types_compatible_p (typeof (hot), typeof (laura))
21         && __builtin_types_compatible_p (int[5], int[])
22         && __builtin_types_compatible_p (same1, same2)))
23     abort ();
24
25   /* Incompatible types.  */
26   if (__builtin_types_compatible_p (char *, int)
27       || __builtin_types_compatible_p (char *, const char *)
28       || __builtin_types_compatible_p (long double, double)
29       || __builtin_types_compatible_p (typeof (i), typeof (d))
30       || __builtin_types_compatible_p (typeof (dingos), typeof (cranberry))
31       || __builtin_types_compatible_p (char, int)
32       || __builtin_types_compatible_p (char *, char **))
33     abort ();
34   exit (0);
35 }