1 /* Test null pointer constants: typedefs for void should be OK but not
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
16 /* (V *)0 is a null pointer constant, so the assignment should be
18 q
= (j
? p
: (V
*)0); /* { dg-error "assignment from incompatible pointer type" } */
19 q
= (j
? p
: (void *)0); /* { dg-error "assignment from incompatible pointer type" } */
20 /* And this conversion should be valid. */
21 (void (*)(void))(V
*)0;
22 (void (*)(void))(void *)0;
23 /* Pointers to qualified void are not valid null pointer
25 fp
= (const void *)0; /* { dg-error "ISO C forbids assignment between function pointer and 'void \\*'" } */
35 fp
== (V
*)1; /* { dg-error "ISO C forbids comparison of 'void \\*' with function pointer" } */
36 (V
*)1 == fp
; /* { dg-error "ISO C forbids comparison of 'void \\*' with function pointer" } */
37 fp
== (const void *)0; /* { dg-error "ISO C forbids comparison of 'void \\*' with function pointer" } */
38 (const void *)0 == fp
; /* { dg-error "ISO C forbids comparison of 'void \\*' with function pointer" } */