1 | // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -Wno-objc-root-class %s |
2 | // rdar://9070460 |
3 | |
4 | class TCPPObject |
5 | { |
6 | public: |
7 | TCPPObject(const TCPPObject& inObj); |
8 | TCPPObject(); |
9 | ~TCPPObject(); |
10 | |
11 | TCPPObject& operator=(const TCPPObject& inObj)const ; // expected-note {{'operator=' declared here}} |
12 | |
13 | void* Data(); |
14 | |
15 | private: |
16 | void* fData; |
17 | }; |
18 | |
19 | |
20 | typedef const TCPPObject& CREF_TCPPObject; |
21 | |
22 | @interface TNSObject |
23 | @property (assign, readwrite, nonatomic) CREF_TCPPObject cppObjectNonAtomic; |
24 | @property (assign, readwrite) CREF_TCPPObject cppObjectAtomic; |
25 | @property (assign, readwrite, nonatomic) const TCPPObject& cppObjectDynamic; |
26 | @end |
27 | |
28 | |
29 | @implementation TNSObject |
30 | |
31 | @synthesize cppObjectNonAtomic; |
32 | @synthesize cppObjectAtomic; // expected-error{{atomic property of reference type 'CREF_TCPPObject' (aka 'const TCPPObject &') cannot have non-trivial assignment operator}} |
33 | @dynamic cppObjectDynamic; |
34 | |
35 | - (const TCPPObject&) cppObjectNonAtomic |
36 | { |
37 | return cppObjectNonAtomic; |
38 | } |
39 | |
40 | - (void) setCppObjectNonAtomic: (const TCPPObject&)cppObject |
41 | { |
42 | cppObjectNonAtomic = cppObject; |
43 | } |
44 | @end |
45 | |
46 | |
47 | // <rdar://problem/11052352> |
48 | @interface NSObject |
49 | + alloc; |
50 | - init; |
51 | - class; |
52 | @end |
53 | |
54 | template<typename T> void f() { |
55 | NSObject *o = [NSObject.alloc init]; |
56 | [o class]; |
57 | } |
58 | |
59 | template void f<int>(); |
60 | |
61 | // rdar://13602832 |
62 | // |
63 | // Make sure that the default-argument checker looks through |
64 | // pseudo-object expressions correctly. The default argument |
65 | // needs to force l2r to test this effectively because the checker |
66 | // is syntactic and runs before placeholders are handled. |
67 | @interface Test13602832 |
68 | - (int) x; |
69 | @end |
70 | namespace test13602832 { |
71 | template <int N> void foo(Test13602832 *a, int limit = a.x + N) {} // expected-error {{default argument references parameter 'a'}} |
72 | |
73 | void test(Test13602832 *a) { |
74 | // FIXME: this is a useless cascade error. |
75 | foo<1024>(a); // expected-error {{no matching function}} |
76 | } |
77 | } |
78 | |