blob: eb31d37b092cac7ef5e0332848a286c440d78087 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* Test C2Y _Generic features: warning with -std=c23 -pedantic. */
/* { dg-do compile } */
/* { dg-options "-std=c23 -pedantic" } */
_Static_assert (_Generic (const int, int : 1, const int : 2) == 2); /* { dg-warning "use of type name" } */
_Static_assert (_Generic (void, int : 1, void : 2) == 2); /* { dg-warning "use of type name" } */
/* { dg-warning "incomplete type" "incomplete type" { target *-*-* } .-1 } */
_Static_assert (_Generic (int (), int (*) () : 1, int () : 2) == 2); /* { dg-warning "use of type name" } */
/* { dg-warning "function type" "function type" { target *-*-* } .-1 } */
const int ci;
_Static_assert (_Generic (typeof (ci), const int : 1, int : 2) == 1); /* { dg-warning "use of type name" } */
_Static_assert (_Generic (ci, const int : 1, int : 2) == 2);
|