[cfe-commits] r105817 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaObjCXX/overload.mm

John McCall rjmccall at apple.com
Fri Jun 11 03:04:23 PDT 2010


Author: rjmccall
Date: Fri Jun 11 05:04:22 2010
New Revision: 105817

URL: http://llvm.org/viewvc/llvm-project?rev=105817&view=rev
Log:
Conversions from Objective C object pointers to bool are "pointer conversions
to bool" in the sense of C++ [over.ics.rank]p4 bullet 1.  I have decreed it.


Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaObjCXX/overload.mm

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=105817&r1=105816&r2=105817&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jun 11 05:04:22 2010
@@ -155,7 +155,9 @@
   // check for their presence as well as checking whether FromType is
   // a pointer.
   if (getToType(1)->isBooleanType() &&
-      (getFromType()->isPointerType() || getFromType()->isBlockPointerType() ||
+      (getFromType()->isPointerType() ||
+       getFromType()->isObjCObjectPointerType() ||
+       getFromType()->isBlockPointerType() ||
        First == ICK_Array_To_Pointer || First == ICK_Function_To_Pointer))
     return true;
 

Modified: cfe/trunk/test/SemaObjCXX/overload.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/overload.mm?rev=105817&r1=105816&r2=105817&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/overload.mm (original)
+++ cfe/trunk/test/SemaObjCXX/overload.mm Fri Jun 11 05:04:22 2010
@@ -93,3 +93,12 @@
     objc_exception_functions_t exc_funcs;
     return exc_funcs.throw_exc; // expected-warning{{incompatible pointer types returning 'void (*)(NSException *)', expected 'void (*)(id)'}}
 }
+
+namespace test5 {
+  void foo(bool);
+  void foo(void *);
+
+  void test(id p) {
+    foo(p);
+  }
+}





More information about the cfe-commits mailing list