blob: d56ac157576f54c50936b6ba31393953a8a3a95a [file] [log] [blame]
John McCalld5c98ae2011-11-15 01:35:18 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Douglas Gregora57a66e2011-02-08 02:14:35 +00002
3struct X {
4 void f() const;
5 ~X();
6};
7
8@interface A {
9 X x_;
10}
11
12- (const X&)x;
13- (void)setx:(const X&)other;
14@end
15
16@implementation A
17
18- (const X&)x { return x_; }
19- (void)setx:(const X&)other { x_ = other; }
20- (void)method {
21 self.x.f();
John McCalld5c98ae2011-11-15 01:35:18 +000022}
Douglas Gregora57a66e2011-02-08 02:14:35 +000023@end
24
John McCalld5c98ae2011-11-15 01:35:18 +000025// rdar://problem/10444030
26@interface Test2
27- (void) setY: (int) y;
28- (int) z;
29@end
30void test2(Test2 *a) {
31 auto y = a.y; // expected-error {{expected getter method not found on object of type 'Test2 *'}} expected-error {{variable 'y' with type 'auto' has incompatible initializer of type}}
32 auto z = a.z;
33}
John McCall9b80c212012-01-11 00:14:46 +000034
35// rdar://problem/10672108
36@interface Test3
37- (int) length;
38@end
39void test3(Test3 *t) {
John McCallfd3b6642012-01-11 01:35:55 +000040 char vla[t.length] = {}; // expected-error {{variable-sized object may not be initialized}}
41 char *heaparray = new char[t.length];
John McCall9b80c212012-01-11 00:14:46 +000042}