[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / deref.c
blob45c921967bccf634bfbdbb64708aafdd6a4653dc
1 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
2 */
3 void
4 foo (void)
6 struct b;
7 struct b* x = 0;
8 struct b* y = &*x;
11 void foo2 (void)
13 typedef int (*arrayptr)[];
14 arrayptr x = 0;
15 arrayptr y = &*x;
18 void foo3 (void)
20 void* x = 0;
21 void* y = &*x; /* expected-warning{{address of an expression of type 'void'}}
22 expected-warning {{ISO C does not allow indirection on operand of type 'void *'}} */
25 extern const void cv1;
27 const void *foo4 (void)
29 return &cv1;
32 extern void cv2;
33 void *foo5 (void)
35 return &cv2; /* expected-warning{{address of an expression of type 'void'}} */
38 typedef const void CVT;
39 extern CVT cv3;
41 const void *foo6 (void)
43 return &cv3;