xref: /minix/external/bsd/llvm/dist/clang/test/Sema/deref.c (revision 83133719)
1 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
2  */
3 void
4 foo (void)
5 {
6  struct b;
7  struct b* x = 0;
8  struct b* y = &*x;
9 }
10 
11 void foo2 (void)
12 {
13  typedef int (*arrayptr)[];
14  arrayptr x = 0;
15  arrayptr y = &*x;
16 }
17 
18 void foo3 (void)
19 {
20  void* x = 0;
21  void* y = &*x; /* expected-warning{{address of an expression of type 'void'}} */
22 }
23 
24 extern const void cv1;
25 
26 const void *foo4 (void)
27 {
28   return &cv1;
29 }
30 
31 extern void cv2;
32 void *foo5 (void)
33 {
34   return &cv2; /* expected-warning{{address of an expression of type 'void'}} */
35 }
36 
37 typedef const void CVT;
38 extern CVT cv3;
39 
40 const void *foo6 (void)
41 {
42   return &cv3;
43 }
44 
45