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