From da518417fa48d875a2950448f6c2027d816d51ad Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 5 Aug 2010 05:30:45 +0000 Subject: [PATCH] Permit template argument deduction to add qualifiers within ObjC object pointers like it can with normal and member pointers. llvm-svn: 110313 --- clang/lib/Sema/SemaTemplateDeduction.cpp | 3 ++- clang/test/SemaObjCXX/deduction.mm | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 885cb06dcad9..3f54bbe43362 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -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, diff --git a/clang/test/SemaObjCXX/deduction.mm b/clang/test/SemaObjCXX/deduction.mm index 6dd449d6ea75..220f36863bab 100644 --- a/clang/test/SemaObjCXX/deduction.mm +++ b/clang/test/SemaObjCXX/deduction.mm @@ -56,3 +56,10 @@ namespace test1 { template struct tester; // expected-note {{in instantiation}} template struct tester >; // expected-note {{in instantiation}} } + +namespace test2 { + template void foo(const T* t) {} + void test(id x) { + foo(x); + } +}