51 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3 4template<class T>5class TNSAutoRef6{7public:8 TNSAutoRef(T t)9 : fRef(t)10 { }11 12 ~TNSAutoRef()13 { }14 15 operator T() const16 { return fRef; }17 18 T Get() const19 { return fRef; }20 21private:22 T fRef;23};24 25@interface NSObject26- (id) alloc;27- (id)init;28@end29 30@interface TFoo : NSObject31- (void) foo;32@end33 34@implementation TFoo35- (void) foo {}36@end37 38@interface TBar : NSObject39- (void) foo;40@end41 42@implementation TBar 43- (void) foo {}44@end45 46int main () {47 TNSAutoRef<TBar*> bar([[TBar alloc] init]);48 [bar foo];49 return 0;50}51