annotate gcc/testsuite/gcc.dg/c90-const-expr-10.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for constant expressions: invalid null pointer constants in
kono
parents:
diff changeset
2 various contexts (make sure NOPs are not inappropriately
kono
parents:
diff changeset
3 stripped). */
kono
parents:
diff changeset
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
kono
parents:
diff changeset
5 /* { dg-do compile } */
kono
parents:
diff changeset
6 /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 __extension__ typedef __SIZE_TYPE__ size_t;
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 void *p = (size_t)(void *)0; /* { dg-error "without a cast" } */
kono
parents:
diff changeset
11 struct s { void *a; } q = { (size_t)(void *)0 }; /* { dg-error "without a cast|near initialization" } */
kono
parents:
diff changeset
12 void *
kono
parents:
diff changeset
13 f (void)
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 void *r;
kono
parents:
diff changeset
16 r = (size_t)(void *)0; /* { dg-error "without a cast" } */
kono
parents:
diff changeset
17 return (size_t)(void *)0; /* { dg-error "without a cast" } */
kono
parents:
diff changeset
18 }
kono
parents:
diff changeset
19 void g (void *); /* { dg-message "but argument is of type" } */
kono
parents:
diff changeset
20 void
kono
parents:
diff changeset
21 h (void)
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 g ((size_t)(void *)0); /* { dg-error "without a cast" } */
kono
parents:
diff changeset
24 }
kono
parents:
diff changeset
25 void g2 (int, void *); /* { dg-message "but argument is of type" } */
kono
parents:
diff changeset
26 void
kono
parents:
diff changeset
27 h2 (void)
kono
parents:
diff changeset
28 {
kono
parents:
diff changeset
29 g2 (0, (size_t)(void *)0); /* { dg-error "without a cast" } */
kono
parents:
diff changeset
30 }