aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-generic-4.c
blob: f9f65615dd989f72d40415562260717a3c046d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Test C2Y _Generic features: no warning or error with -std=c23 by
   default.  */
/* { dg-do compile } */
/* { dg-options "-std=c23" } */

_Static_assert (_Generic (const int, int : 1, const int : 2) == 2);

_Static_assert (_Generic (void, int : 1, void : 2) == 2);

_Static_assert (_Generic (int (), int (*) () : 1, int () : 2) == 2);

const int ci;

_Static_assert (_Generic (typeof (ci), const int : 1, int : 2) == 1);

_Static_assert (_Generic (ci, const int : 1, int : 2) == 2);