1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s 2// expected-no-diagnostics 3 4typedef const struct __attribute__((objc_bridge(NSAttributedString))) __CFAttributedString *CFAttributedStringRef; 5 6typedef struct __attribute__((objc_bridge_mutable(NSMutableAttributedString))) __CFAttributedString *CFMutableAttributedStringRef; 7 8@interface NSAttributedString 9@end 10 11@interface NSMutableAttributedString 12@end 13 14struct __CFAttributedString { 15}; 16 17void Test1(CFAttributedStringRef attrStr, CFMutableAttributedStringRef mutable_attrStr) 18{ 19 id x = (NSAttributedString *) attrStr; 20 id x1 =(NSAttributedString *) mutable_attrStr; 21 id x2 = (NSMutableAttributedString *) attrStr; 22 id x3 = (NSMutableAttributedString *) mutable_attrStr; 23} 24 25void Test2(NSAttributedString *ns_attrStr, NSMutableAttributedString *ns_mutable_attr_Str) { 26 CFAttributedStringRef cfsr = (CFAttributedStringRef) ns_attrStr; 27 CFMutableAttributedStringRef cfsr1 = (CFMutableAttributedStringRef) ns_attrStr; 28 CFAttributedStringRef cfsr2 = (CFAttributedStringRef) ns_mutable_attr_Str; 29 CFMutableAttributedStringRef cfsr3 = (CFMutableAttributedStringRef) ns_mutable_attr_Str; 30} 31 32// Tests with no definition declaration for struct __NDCFAttributedString. 33typedef const struct __attribute__((objc_bridge(NSAttributedString))) __NDCFAttributedString *NDCFAttributedStringRef; 34 35typedef struct __attribute__((objc_bridge_mutable(NSMutableAttributedString))) __NDCFAttributedString *NDCFMutableAttributedStringRef; 36 37void Test3(NDCFAttributedStringRef attrStr, NDCFMutableAttributedStringRef mutable_attrStr) 38{ 39 id x = (NSAttributedString *) attrStr; 40 id x1 =(NSAttributedString *) mutable_attrStr; 41 id x2 = (NSMutableAttributedString *) attrStr; 42 id x3 = (NSMutableAttributedString *) mutable_attrStr; 43} 44 45void Test4(NSAttributedString *ns_attrStr, NSMutableAttributedString *ns_mutable_attr_Str) { 46 NDCFAttributedStringRef cfsr = (NDCFAttributedStringRef) ns_attrStr; 47 NDCFMutableAttributedStringRef cfsr1 = (NDCFMutableAttributedStringRef) ns_attrStr; 48 NDCFAttributedStringRef cfsr2 = (NDCFAttributedStringRef) ns_mutable_attr_Str; 49 NDCFMutableAttributedStringRef cfsr3 = (NDCFMutableAttributedStringRef) ns_mutable_attr_Str; 50} 51