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