1 /* Test C11 constraint against pointer / floating-point casts. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
4
5 void *p;
6 float f;
7 double d;
8 long double ld;
9 _Complex float cf;
10 _Complex double cd;
11 _Complex long double cld;
12
13 void
func(void)14 func (void)
15 {
16 f = (float) p; /* { dg-error "pointer" } */
17 d = (double) p; /* { dg-error "pointer" } */
18 ld = (long double) p; /* { dg-error "pointer" } */
19 cf = (_Complex float) p; /* { dg-error "pointer" } */
20 cd = (_Complex double) p; /* { dg-error "pointer" } */
21 cld = (_Complex long double) p; /* { dg-error "pointer" } */
22 p = (void *) f; /* { dg-error "pointer" } */
23 p = (void *) d; /* { dg-error "pointer" } */
24 p = (void *) ld; /* { dg-error "pointer" } */
25 p = (void *) cf; /* { dg-error "pointer" } */
26 p = (void *) cd; /* { dg-error "pointer" } */
27 p = (void *) cld; /* { dg-error "pointer" } */
28 }
29