OSDN Git Service

2012-01-30 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / c-c++-common / Wint-to-pointer-cast-3.c
1 /* Test -Wno-int-to-pointer-cast.  */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wno-int-to-pointer-cast" } */
5
6 char c;
7
8 void *
9 f (void)
10 {
11   return (void *) c;
12 }
13
14 void *p;
15
16 char
17 g (void)
18 {
19   return (char) p;
20 /* { dg-warning "cast from pointer to integer of different size" "" { target c } 19 } */
21 /* { dg-error "cast from 'void\\*' to 'char' loses precision" "" { target c++ } 19 } */
22 }