theraven added a comment.

We seem to be missing tests for the assignment part of this patch.



================
Comment at: lib/Sema/SemaExpr.cpp:7749
+    // id (or strictly compatible object type) -> T^
+    if (getLangOpts().ObjC1 && 
RHSType->isBlockCompatibleObjCPointerType(Context)) {
       Kind = CK_AnyPointerToBlockPointerCast;
----------------
Do we want to allow implicit casts for all object types to block types for 
assignment, or only for null pointers?  We definitely want to allow `nil` to be 
assigned to a block type, but I would lean slightly to requiring an implicit 
cast.

Ideally, I think we'd allow this but warn, because casting from an arbitrary 
ObjC type to a block incorrectly can cause exciting security vulnerabilities if 
it's done incorrectly and we should encourage people to check these casts 
(`nil` is always safe though - as long as somewhere else checks the nullability 
attributes).


Repository:
  rC Clang

https://reviews.llvm.org/D44580



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to