Permit template argument deduction to add qualifiers within ObjC object

pointers like it can with normal and member pointers.

llvm-svn: 110313
This commit is contained in:
John McCall 2010-08-05 05:30:45 +00:00
parent 3b3a5ed72d
commit da518417fa
2 changed files with 9 additions and 1 deletions

View 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,

View 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);
}
}