]> granicus.if.org Git - clang/commitdiff
objc-arc: Allow unbridged cast of retainable object to
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 22 Jun 2011 16:36:45 +0000 (16:36 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 22 Jun 2011 16:36:45 +0000 (16:36 +0000)
integral as it is not transferring ownership..
// rdar://9619861

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133622 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprObjC.cpp
test/SemaObjC/arc.m

index 83b01f24a218df8075af8284ad12193265495d99..84ac897b376d7cc3fcb60c4f00c80c27c10f32ee 100644 (file)
@@ -1620,7 +1620,7 @@ Sema::CheckObjCARCConversion(SourceRange castRange, QualType castType,
   ARCConversionTypeClass exprACTC = classifyTypeForARCConversion(castExprType);
   ARCConversionTypeClass castACTC = classifyTypeForARCConversion(castType);
   if (exprACTC == castACTC) return;
-  if (exprACTC && castType->isBooleanType()) return;
+  if (exprACTC && castType->isIntegralType(Context)) return;
   
   // Allow casts between pointers to lifetime types (e.g., __strong id*)
   // and pointers to void (e.g., cv void *). Casting from void* to lifetime*
index d867b7332e5fe56eb2252092241b2b1018f37a9e..e1e6b07456e40820bfd0b18cd71c9f199fedf9e6 100644 (file)
@@ -563,3 +563,12 @@ id Test32(__weak ITest32 *x) {
            : (*x).ivar;  // expected-error {{dereferencing a __weak pointer is not allowed}}
 }
 
+// rdar://9619861
+extern int printf(const char*, ...);
+typedef long intptr_t;
+
+int Test33(id someid) {
+  printf( "Hello%ld", (intptr_t)someid);
+  return (int)someid;
+}
+