xref: /llvm-project/clang/test/SemaObjC/property-not-lvalue.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3typedef struct NSSize {
4     		int width;
5		struct {
6		  int dim;
7		} inner;
8} NSSize;
9
10typedef __attribute__((__ext_vector_type__(2))) float simd_float2;
11
12@interface Foo  {
13        NSSize _size;
14}
15@property NSSize size;
16@property simd_float2 f2;
17@end
18
19void foo(void) {
20        Foo *f;
21        f.size.width = 2.2; // expected-error {{expression is not assignable}}
22	f.size.inner.dim = 200; // expected-error {{expression is not assignable}}
23}
24
25@interface Gorf  {
26}
27- (NSSize)size;
28@end
29
30@implementation Gorf
31- (void)MyView_sharedInit {
32    self.size.width = 2.2; // expected-error {{expression is not assignable}}
33}
34- (NSSize)size {}
35@end
36
37// clang used to crash compiling this code.
38void test(Foo *f) {
39  simd_float2 *v = &f.f2.xy; // expected-error {{cannot take the address of an rvalue}}
40}
41