summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjCXX/conversion-to-objc-pointer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjCXX/conversion-to-objc-pointer.mm')
-rw-r--r--clang/test/SemaObjCXX/conversion-to-objc-pointer.mm50
1 files changed, 50 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/conversion-to-objc-pointer.mm b/clang/test/SemaObjCXX/conversion-to-objc-pointer.mm
new file mode 100644
index 0000000..235aaac
--- /dev/null
+++ b/clang/test/SemaObjCXX/conversion-to-objc-pointer.mm
@@ -0,0 +1,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;
+}