[cfe-commits] r129603 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaObjCXX/overload.mm
Douglas Gregor
dgregor at apple.com
Fri Apr 15 13:45:44 PDT 2011
Author: dgregor
Date: Fri Apr 15 15:45:44 2011
New Revision: 129603
URL: http://llvm.org/viewvc/llvm-project?rev=129603&view=rev
Log:
For the purposes of overload resolution, consider a conversion from an
Objective-C pointer to void* as a "conversion to void*". This allows
us to prefer an Objective-C object pointer conversion to a superclass
object pointer over an Objective-C object pointer conversion to
cv-void*. Fixes PR9735.
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=129603&r1=129602&r2=129603&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Apr 15 15:45:44 2011
@@ -240,7 +240,7 @@
if (First == ICK_Array_To_Pointer)
FromType = Context.getArrayDecayedType(FromType);
- if (Second == ICK_Pointer_Conversion && FromType->isPointerType())
+ if (Second == ICK_Pointer_Conversion && FromType->isAnyPointerType())
if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
return ToPtrType->getPointeeType()->isVoidType();
Modified: cfe/trunk/test/SemaObjCXX/overload.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/overload.mm?rev=129603&r1=129602&r2=129603&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/overload.mm (original)
+++ cfe/trunk/test/SemaObjCXX/overload.mm Fri Apr 15 15:45:44 2011
@@ -149,3 +149,13 @@
f2(a);
}
}
+
+namespace PR9735 {
+ int &f3(const A*);
+ float &f3(const void*);
+
+ void test_f(B* b, const B* bc) {
+ int &ir1 = f3(b);
+ int &ir2 = f3(bc);
+ }
+}
More information about the cfe-commits
mailing list