PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-const-expr-10.c
blob2aca6106a47b65167e95ad04bb1787f56eb20f98
1 /* Test for constant expressions: invalid null pointer constants in
2 various contexts (make sure NOPs are not inappropriately
3 stripped). */
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
8 void *p = (__SIZE_TYPE__)(void *)0; /* { dg-error "without a cast" } */
9 struct s { void *a; } q = { (__SIZE_TYPE__)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
10 void *
11 f (void)
13 void *r;
14 r = (__SIZE_TYPE__)(void *)0; /* { dg-error "without a cast" } */
15 return (__SIZE_TYPE__)(void *)0; /* { dg-error "without a cast" } */
17 void g (void *); /* { dg-message "but argument is of type" } */
18 void
19 h (void)
21 g ((__SIZE_TYPE__)(void *)0); /* { dg-error "without a cast" } */
23 void g2 (int, void *); /* { dg-message "but argument is of type" } */
24 void
25 h2 (void)
27 g2 (0, (__SIZE_TYPE__)(void *)0); /* { dg-error "without a cast" } */