diff options
author | John McCall <rjmccall@apple.com> | 2010-08-05 05:30:45 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-05 05:30:45 +0000 |
commit | db0bc4706c4bda8e9166f40b5c7cfda656100818 (patch) | |
tree | b2ce230673ba72b3ead1eb7950c71b988e863f01 | |
parent | 67c4a0ca65dd72784a1778264938c8ba45506cea (diff) |
Permit template argument deduction to add qualifiers within ObjC object
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
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjCXX/deduction.mm | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 885cb06dca..3f54bbe433 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/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/test/SemaObjCXX/deduction.mm b/test/SemaObjCXX/deduction.mm index 6dd449d6ea..220f36863b 100644 --- a/test/SemaObjCXX/deduction.mm +++ b/test/SemaObjCXX/deduction.mm @@ -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); + } +} |