summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjCXX/conversion-to-objc-pointer.mm
blob: 235aaac8d09cdb3277b23613fd9574e686447ff6 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar: // 7963410

template<class T>
class TNSAutoRef
{
public:
	TNSAutoRef(T t)
		:	fRef(t)
		{ }

	~TNSAutoRef()
		{  }

	operator T() const
		{ return fRef; }
	
	T Get() const
		{ return fRef; }

private:
	T fRef;
};

@interface NSObject
- (id) alloc;
- (id)init;
@end

@interface TFoo : NSObject
- (void) foo;
@end

@implementation TFoo
- (void) foo {}
@end

@interface TBar : NSObject
- (void) foo;
@end

@implementation TBar 
- (void) foo {}
@end

int main () {
	TNSAutoRef<TBar*> bar([[TBar alloc] init]);
	[bar foo];
	return 0;
}