summaryrefslogtreecommitdiffstats
path: root/test/ARCMT/nonobjc-to-objc-cast.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/ARCMT/nonobjc-to-objc-cast.m')
-rw-r--r--test/ARCMT/nonobjc-to-objc-cast.m27
1 files changed, 22 insertions, 5 deletions
diff --git a/test/ARCMT/nonobjc-to-objc-cast.m b/test/ARCMT/nonobjc-to-objc-cast.m
index fcdcd89..55b6655 100644
--- a/test/ARCMT/nonobjc-to-objc-cast.m
+++ b/test/ARCMT/nonobjc-to-objc-cast.m
@@ -5,11 +5,6 @@
#include "Common.h"
-@interface NSString : NSObject
--(id)string;
--(id)newString;
-@end
-
typedef const struct __CFString * CFStringRef;
extern const CFStringRef kUTTypePlainText;
extern const CFStringRef kUTTypeRTF;
@@ -21,6 +16,18 @@ extern const CFAllocatorRef kCFAllocatorDefault;
extern CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid);
+struct StrS {
+ CFStringRef sref_member;
+};
+
+@interface NSString : NSObject {
+ CFStringRef sref;
+ struct StrS *strS;
+}
+-(id)string;
+-(id)newString;
+@end
+
void f(BOOL b, id p) {
NSString *str = (NSString *)kUTTypePlainText;
str = b ? kUTTypeRTF : kUTTypePlainText;
@@ -41,6 +48,16 @@ void f(BOOL b, id p) {
}
@end
+@implementation NSString
+-(id)string {
+ if (0)
+ return sref;
+ else
+ return strS->sref_member;
+}
+-(id)newString { return 0; }
+@end
+
extern void consumeParam(CFStringRef CF_CONSUMED p);
void f2(NSString *s) {
OpenPOWER on IntegriCloud