PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / c90-const-expr-10.c
blob30c60e31f90568a08d55b229020e609a873b7c98
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:1990 -pedantic-errors" } */
8 __extension__ typedef __SIZE_TYPE__ size_t;
10 void *p = (size_t)(void *)0; /* { dg-error "without a cast" } */
11 struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
12 void *
13 f (void)
15 void *r;
16 r = (size_t)(void *)0; /* { dg-error "without a cast" } */
17 return (size_t)(void *)0; /* { dg-error "without a cast" } */
19 void g (void *); /* { dg-message "but argument is of type" } */
20 void
21 h (void)
23 g ((size_t)(void *)0); /* { dg-error "without a cast" } */
25 void g2 (int, void *); /* { dg-message "but argument is of type" } */
26 void
27 h2 (void)
29 g2 (0, (size_t)(void *)0); /* { dg-error "without a cast" } */