[llvm-branch-commits] [cfe-branch] r121053 - in /cfe/branches/Apple/whitney: lib/Sema/SemaOverload.cpp test/SemaObjCXX/overload.mm

Daniel Dunbar daniel at zuster.org
Mon Dec 6 14:38:39 PST 2010


Author: ddunbar
Date: Mon Dec  6 16:38:39 2010
New Revision: 121053

URL: http://llvm.org/viewvc/llvm-project?rev=121053&view=rev
Log:
Merge r121047:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Mon Dec 6 22:09:19 2010 +0000

    Objective-C pointer conversions to 'id' or qualified 'id' subsume
    cv-qualification conversions. More specifically, there's an implicit
    cv-qualification conversion (even one that drops qualifiers) when
    converting to 'id' or qualified 'id'. Fixes <rdar://problem/8734046>.

Modified:
    cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
    cfe/branches/Apple/whitney/test/SemaObjCXX/overload.mm

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp?rev=121053&r1=121052&r2=121053&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaOverload.cpp Mon Dec  6 16:38:39 2010
@@ -1353,6 +1353,11 @@
   assert((FromPtr->getTypeClass() == Type::Pointer ||
           FromPtr->getTypeClass() == Type::ObjCObjectPointer) &&
          "Invalid similarly-qualified pointer type");
+  
+  /// \brief Conversions to 'id' subsume cv-qualifier conversions.
+  if (ToType->isObjCIdType() || ToType->isObjCQualifiedIdType())
+    return ToType.getUnqualifiedType();
+  
   QualType CanonFromPointee 
     = Context.getCanonicalType(FromPtr->getPointeeType());
   QualType CanonToPointee = Context.getCanonicalType(ToPointee);

Modified: cfe/branches/Apple/whitney/test/SemaObjCXX/overload.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjCXX/overload.mm?rev=121053&r1=121052&r2=121053&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjCXX/overload.mm (original)
+++ cfe/branches/Apple/whitney/test/SemaObjCXX/overload.mm Mon Dec  6 16:38:39 2010
@@ -142,3 +142,12 @@
 
   
 }
+
+namespace rdar8734046 {
+  void f1(id);
+  void f2(id<P0>);
+  void g(const A *a) {
+    f1(a);
+    f2(a);
+  }
+}





More information about the llvm-branch-commits mailing list