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