1 /* { dg-do run { target { c || c++11 } } } */
3 #if !defined(__cplusplus) && __STDC_VERSION__ <= 201710L
4 #define static_assert _Static_assert
6 #define false ((_Bool) 0)
9 extern "C" void abort ();
11 extern void abort (void);
18 struct S
{ int s
; } s
= { 0 };
19 union U
{ int u
; } u
= { 0 };
22 const char *p
= (const char *) 0;
24 _Complex
double c
= 0.0;
26 struct T
{ void foo (); };
30 static_assert (__builtin_classify_type (void) == 0, "");
31 static_assert (__builtin_classify_type (int) == 1, "");
32 static_assert (__builtin_classify_type (enum E
) == 3, "");
33 static_assert (__builtin_classify_type (bool) == 4, "");
34 static_assert (__builtin_classify_type (const char *) == 5, "");
36 static_assert (__builtin_classify_type (int &) == 6, "");
37 static_assert (__builtin_classify_type (int &&) == 6, "");
38 static_assert (__builtin_classify_type (int S::*) == 7, "");
40 static_assert (__builtin_classify_type (float) == 8, "");
41 static_assert (__builtin_classify_type (_Complex
double) == 9, "");
42 static_assert (__builtin_classify_type (int (int, int)) == 10, "");
43 static_assert (__builtin_classify_type (struct S
) == 12, "");
44 static_assert (__builtin_classify_type (union U
) == 13, "");
45 static_assert (__builtin_classify_type (int [2]) == 14, "");
46 static_assert (__builtin_classify_type (__typeof__ (a
[0])) == 1, "");
47 static_assert (__builtin_classify_type (__typeof__ (e
)) == 3, "");
48 static_assert (__builtin_classify_type (__typeof__ (b
)) == 4, "");
49 static_assert (__builtin_classify_type (__typeof__ (p
)) == 5, "");
51 static_assert (__builtin_classify_type (decltype (r
)) == 6, "");
52 static_assert (__builtin_classify_type (__typeof__ (q
)) == 7, "");
54 static_assert (__builtin_classify_type (__typeof__ (f
)) == 8, "");
55 static_assert (__builtin_classify_type (__typeof__ (c
)) == 9, "");
56 static_assert (__builtin_classify_type (__typeof__ (main
)) == 10, "");
57 static_assert (__builtin_classify_type (__typeof__ (s
)) == 12, "");
58 static_assert (__builtin_classify_type (__typeof__ (u
)) == 13, "");
59 static_assert (__builtin_classify_type (__typeof__ (a
)) == 14, "");
61 static_assert (__builtin_classify_type (a
[0]) == 1, "");
62 static_assert (__builtin_classify_type (e
) == 1, "");
63 static_assert (__builtin_classify_type (b
) == 1, "");
64 static_assert (__builtin_classify_type (p
) == 5, "");
65 static_assert (__builtin_classify_type (f
) == 8, "");
66 static_assert (__builtin_classify_type (c
) == 9, "");
67 static_assert (__builtin_classify_type (main
) == 5, "");
68 static_assert (__builtin_classify_type (s
) == 12, "");
69 static_assert (__builtin_classify_type (u
) == 13, "");
70 static_assert (__builtin_classify_type (a
) == 5, "");
72 if (__builtin_classify_type (a
[0]) != 1)
75 if (__builtin_classify_type (e
) != 3)
77 if (__builtin_classify_type (b
) != 4)
80 if (__builtin_classify_type (e
) != 1)
82 if (__builtin_classify_type (b
) != 1)
85 if (__builtin_classify_type (p
) != 5)
88 if (__builtin_classify_type (r
) != 1)
90 if (__builtin_classify_type (q
) != 7)
93 if (__builtin_classify_type (f
) != 8)
95 if (__builtin_classify_type (c
) != 9)
97 if (__builtin_classify_type (main
) != 5)
99 if (__builtin_classify_type (s
) != 12)
101 if (__builtin_classify_type (u
) != 13)
103 if (__builtin_classify_type (a
) != 5)