Showing the changes to tests (2 of 3 files). Show all
Unified · Split
| @@ -30,6 +30,12 @@ void void_foo(int i) {} · 29 unmodified lines | |||
| 30 | 30 | ||
| 31 | typedef int int_type1; | 31 | typedef int int_type1; |
| 32 | 32 | ||
| 33 | typedef int T[4]; | ||
| 34 | int f(T t) | ||
| 35 | { | ||
| 36 | return _Generic(t, __typeof__( ((void)0, (T){0}) ) : 1 ); | ||
| 37 | } | ||
| 38 | |||
| 33 | #define gen_sw(a) _Generic(a, const char *: 1, default: 8, int: 123); | 39 | #define gen_sw(a) _Generic(a, const char *: 1, default: 8, int: 123); |
| 34 | 40 | ||
| 35 | int main() | 41 | int main() |
| @@ -40,6 +46,7 @@ int main() · 4 unmodified lines | |||
| 40 | const int * const ptr; | 46 | const int * const ptr; |
| 41 | const char *ti; | 47 | const char *ti; |
| 42 | int_type1 i2; | 48 | int_type1 i2; |
| 49 | T t; | ||
| 43 | 50 | ||
| 44 | i = _Generic(a, int: a_f, const int: b_f)(); | 51 | i = _Generic(a, int: a_f, const int: b_f)(); |
| 45 | printf("%d\n", i); | 52 | printf("%d\n", i); |
| @@ -118,5 +125,7 @@ int main() · 72 unmodified lines | |||
| 118 | (void)(sizeof(struct { int x:_Generic( 0?(int (*)[5])0 : ar, int (*)[5]:+1, int (*)[4]:(void)0); })); | 125 | (void)(sizeof(struct { int x:_Generic( 0?(int (*)[5])0 : ar, int (*)[5]:+1, int (*)[4]:(void)0); })); |
| 119 | } | 126 | } |
| 120 | 127 | ||
| 128 | printf ("%d\n", f(t)); | ||
| 129 | |||
| 121 | return 0; | 130 | return 0; |
| 122 | } | 131 | } |
| @@ -13,3 +13,4 @@ long · 12 unmodified lines | |||
| 13 | 1 | 13 | 1 |
| 14 | 3 | 14 | 3 |
| 15 | 5 | 15 | 5 |
| 16 | 1 | ||