blob: 46ba5dae4dd2587b4f02a1838cdf0b949fafab9b [file] [log] [blame]
Chris Lattnera3249072007-11-16 17:46:48 +00001// RUN: clang %s -verify -fsyntax-only
Steve Naroff73cf87e2008-02-29 23:30:25 +00002struct xx { int bitf:1; };
3
4struct entry { struct xx *whatever;
5 int value;
6 int bitf:1; };
Chris Lattnera3249072007-11-16 17:46:48 +00007void add_one(int *p) { (*p)++; }
8
9void test() {
10 register struct entry *p;
11 add_one(&p->value);
Steve Naroff73cf87e2008-02-29 23:30:25 +000012 struct entry pvalue;
13 add_one(&p->bitf); // expected-error {{address of bit-field requested}}
14 add_one(&pvalue.bitf); // expected-error {{address of bit-field requested}}
15 add_one(&p->whatever->bitf); // expected-error {{address of bit-field requested}}
Chris Lattnera3249072007-11-16 17:46:48 +000016}
17
18void foo() {
19 register int x[10];
20 &x[10]; // expected-error {{address of register variable requested}}
Anders Carlsson4b3db2b2008-02-01 07:15:58 +000021
22 register int *y;
23
24 int *x2 = &y; // expected-error {{address of register variable requested}}
25 int *x3 = &y[10];
Chris Lattnera3249072007-11-16 17:46:48 +000026}
27
Steve Naroff73cf87e2008-02-29 23:30:25 +000028void testVectorComponentAccess() {
29 typedef float v4sf __attribute__ ((vector_size (16)));
30 static v4sf q;
31 float* r = &q[0]; // expected-error {{address of vector requested}}
32}
Chris Lattnera3249072007-11-16 17:46:48 +000033