1 // RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
2 struct xx
{ int bitf
:1; };
4 struct entry
{ struct xx
*whatever
;
7 void add_one(int *p
) { (*p
)++; }
10 register struct entry
*p
;
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}}
20 &x
[10]; // expected-error {{address of register variable requested}}
24 int *x2
= &y
; // expected-error {{address of register variable requested}}
28 void testVectorComponentAccess(void) {
29 typedef float v4sf
__attribute__ ((vector_size (16)));
31 float* r
= &q
[0]; // expected-error {{address of vector element requested}}
34 typedef __attribute__(( ext_vector_type(4) )) float float4
;
36 float *testExtVectorComponentAccess(float4 x
) {
37 return &x
.w
; // expected-error {{address of vector element requested}}
42 int *_dummy0
= &(*x0
);
45 int *_dummy1
= &(*(x1
+ 1));
50 int *_dummy00
= x0
; // expected-error {{address of register variable requested}}
51 int *_dummy01
= &(*x0
); // expected-error {{address of register variable requested}}
54 int *_dummy1
= &(*(x1
+ 1)); // expected-error {{address of register variable requested}}
57 int *_dummy2
= &(*(x2
+ 1));
59 register int x3
[10][10][10];
60 int(*_dummy3
)[10] = &x3
[0][0]; // expected-error {{address of register variable requested}}
62 register struct { int f0
[10]; } x4
;
63 int *_dummy4
= &x4
.f0
[2]; // expected-error {{address of register variable requested}}
65 add_one(x0
); // expected-error {{address of register variable requested}}
66 (void)sizeof(x0
); // OK, not an array decay.
68 int *p
= ((int *)x0
)++; // expected-error {{address of register variable requested}}
74 int *_dummy0
= &y
; // expected-error {{address of register variable requested}}
75 int *_dummy1
= &y
[10];
80 void (*_dummy0
)(void) = &****f4
;
84 register _Complex
int x
;
86 int *_dummy0
= &__real__ x
; // expected-error {{address of register variable requested}}
92 int *_dummy0
= &(int*) arr
; // expected-error {{address of register variable requested}}
93 int *_dummy1
= &(arr
+ 1); // expected-error {{address of register variable requested}}
96 void f6(register int x
) {
97 int * dummy0
= &x
; // expected-error {{address of register variable requested}}
101 register struct {char* x
;} t1
= {"Hello"};
102 char* dummy1
= &(t1
.x
[0]);
104 struct {int a
: 10; struct{int b
: 10;};} t2
;
105 int* dummy2
= &(t2
.a
); // expected-error {{address of bit-field requested}}
106 int* dummy3
= &(t2
.b
); // expected-error {{address of bit-field requested}}
108 void* t3
= &(*(void*)0);
112 void *dummy0
= &f8(); // expected-error {{cannot take the address of an rvalue of type 'void'}}
115 void *dummy1
= &(1 ? v
: f8()); // expected-error {{cannot take the address of an rvalue of type 'void'}}
117 void *dummy2
= &(f8(), v
); // expected-error {{cannot take the address of an rvalue of type 'void'}}
119 void *dummy3
= &({ ; }); // expected-error {{cannot take the address of an rvalue of type 'void'}}
124 void (*_dummy0
)() = &****knr
;