You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/test/SemaObjCXX/arc-type-conversion.mm
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -76,13 +76,17 @@ void test_reinterpret_cast(__strong id *sip, __weak id *wip,
76
76
(void)reinterpret_cast<__weak id *>(csip); // expected-error{{reinterpret_cast from '__strong id const *' to '__weak id *' casts away qualifiers}}
77
77
(void)reinterpret_cast<__strong id *>(cwip); // expected-error{{reinterpret_cast from '__weak id const *' to '__strong id *' casts away qualifiers}}
78
78
79
-
auto *p0 = reinterpret_cast<unsignedlong *>(sip);
80
-
(void)reinterpret_cast<__strong id *>(p0);
81
-
auto *p1 = reinterpret_cast<__weak NSString *>(sip);
82
-
(void)reinterpret_cast<__strong id *>(p1);
79
+
auto *ul = reinterpret_cast<unsignedlong *>(sip);
80
+
(void)reinterpret_cast<__strong id *>(ul);
81
+
auto *wp = reinterpret_cast<__weak NSString *>(sip);
82
+
(void)reinterpret_cast<__strong id *>(wp);
83
83
(void)reinterpret_cast<unsignedlong *>(csip); // expected-error {{reinterpret_cast from '__strong id const *' to 'unsigned long *' casts away qualifiers}}
84
-
constunsignedlong *p2 = nullptr;
85
-
(void)reinterpret_cast<__strong id *>(p2); // expected-error {{reinterpret_cast from 'const unsigned long *' to '__strong id *' casts away qualifiers}}
84
+
constunsignedlong *cul = nullptr;
85
+
(void)reinterpret_cast<__strong id *>(cul); // expected-error {{reinterpret_cast from 'const unsigned long *' to '__strong id *' casts away qualifiers}}
86
+
volatile __strong id *vsip = nullptr;
87
+
(void)reinterpret_cast<unsignedlong *>(vsip); // expected-error {{reinterpret_cast from '__strong id volatile *' to 'unsigned long *' casts away qualifiers}}
88
+
volatileunsignedlong *vul = nullptr;
89
+
(void)reinterpret_cast<__strong id *>(vul); // expected-error {{reinterpret_cast from 'volatile unsigned long *' to '__strong id *' casts away qualifiers}}
86
90
auto uip = reinterpret_cast<uintptr_t>(sip);
87
91
(void)reinterpret_cast<__strong id *>(uip); // expected-error {{to '__strong id *' is disallowed with ARC}}
0 commit comments