Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/builtin-types-compatible-p.c

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