]> granicus.if.org Git - clang/commitdiff
Permit template argument deduction to add qualifiers within ObjC object
authorJohn McCall <rjmccall@apple.com>
Thu, 5 Aug 2010 05:30:45 +0000 (05:30 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 5 Aug 2010 05:30:45 +0000 (05:30 +0000)
pointers like it can with normal and member pointers.

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

lib/Sema/SemaTemplateDeduction.cpp
test/SemaObjCXX/deduction.mm

index 885cb06dcad92f41e029dfbd4cd719950cccce77..3f54bbe43362927b969cc4ed6ac65f9169002d3b 100644 (file)
@@ -1721,7 +1721,8 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
     //     - The transformed A can be another pointer or pointer to member
     //       type that can be converted to the deduced A via a qualification
     //       conversion (4.4).
-    if (ArgType->isPointerType() || ArgType->isMemberPointerType())
+    if (ArgType->isPointerType() || ArgType->isMemberPointerType() ||
+        ArgType->isObjCObjectPointerType())
       TDF |= TDF_IgnoreQualifiers;
     //     - If P is a class and P has the form simple-template-id, then the
     //       transformed A can be a derived class of the deduced A. Likewise,
index 6dd449d6ea7587d0d30ff16ddbba7a54309826fa..220f36863bab7c39e17d784f6378186363f87fff 100644 (file)
@@ -56,3 +56,10 @@ namespace test1 {
   template struct tester<Test1Class>; // expected-note {{in instantiation}}
   template struct tester<Test1Class<Test1Protocol> >; // expected-note {{in instantiation}}
 }
+
+namespace test2 {
+  template <typename T> void foo(const T* t) {}
+  void test(id x) {
+    foo(x);
+  }
+}