blob: 845b28645a483fd5ffb5e305982f00e0ffa48b05 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001/* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
Eli Friedman53202852009-05-03 22:36:05 +00002 */
Steve Naroff08f19672008-01-13 17:10:08 +00003void
4foo (void)
5{
6 struct b;
7 struct b* x = 0;
8 struct b* y = &*x;
9}
10
11void foo2 (void)
12{
13 typedef int (*arrayptr)[];
14 arrayptr x = 0;
15 arrayptr y = &*x;
16}
17
18void foo3 (void)
19{
20 void* x = 0;
Eli Friedman53202852009-05-03 22:36:05 +000021 void* y = &*x; /* expected-warning{{address of an expression of type 'void'}} */
Steve Naroff75ceedf2008-02-10 00:30:18 +000022}
23
24extern const void cv1;
Steve Naroffa0992b62008-02-18 15:14:59 +000025
Steve Naroff75ceedf2008-02-10 00:30:18 +000026const void *foo4 (void)
27{
28 return &cv1;
Steve Naroff08f19672008-01-13 17:10:08 +000029}
30
Steve Naroffacb818a2008-02-10 01:39:04 +000031extern void cv2;
32void *foo5 (void)
33{
Eli Friedman53202852009-05-03 22:36:05 +000034 return &cv2; /* expected-warning{{address of an expression of type 'void'}} */
Steve Naroffacb818a2008-02-10 01:39:04 +000035}
Steve Naroffa0992b62008-02-18 15:14:59 +000036
37typedef const void CVT;
38extern CVT cv3;
39
40const void *foo6 (void)
41{
42 return &cv3;
43}
44