1 /* Test C11 _Generic. Valid uses. */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
5 _Noreturn
extern void exit (int);
6 _Noreturn
extern void abort (void);
20 check (_Generic (n
++, int: 0));
21 /* _Generic should not evaluate its argument. */
24 check (_Generic (n
, double: n
++, default: 0));
27 /* Qualifiers are removed for the purpose of type matching. */
29 check (_Generic (cn
, int: 0, default: n
++));
31 check (_Generic ((const int) n
, int: 0, default: n
++));
34 /* Arrays decay to pointers. */
37 check (_Generic (a
, int *: 0, const int *: n
++));
39 check (_Generic (ca
, const int *: 0, int *: n
++));
42 /* Functions decay to pointers. */
44 check (_Generic (f
, void (*) (void): 0, default: n
++));
47 /* _Noreturn is not part of the function type. */
48 check (_Generic (&abort
, void (*) (void): 0, default: n
++));
51 /* Integer promotions do not occur. */
53 check (_Generic (s
, short: 0, int: n
++));