[cfe-commits] r110313 - in /cfe/trunk: lib/Sema/SemaTemplateDeduction.cpp test/SemaObjCXX/deduction.mm
John McCall
rjmccall at apple.com
Wed Aug 4 22:30:45 PDT 2010
Author: rjmccall
Date: Thu Aug 5 00:30:45 2010
New Revision: 110313
URL: http://llvm.org/viewvc/llvm-project?rev=110313&view=rev
Log:
Permit template argument deduction to add qualifiers within ObjC object
pointers like it can with normal and member pointers.
Modified:
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
cfe/trunk/test/SemaObjCXX/deduction.mm
Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=110313&r1=110312&r2=110313&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Thu Aug 5 00:30:45 2010
@@ -1721,7 +1721,8 @@
// - 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,
Modified: cfe/trunk/test/SemaObjCXX/deduction.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/deduction.mm?rev=110313&r1=110312&r2=110313&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/deduction.mm (original)
+++ cfe/trunk/test/SemaObjCXX/deduction.mm Thu Aug 5 00:30:45 2010
@@ -56,3 +56,10 @@
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);
+ }
+}
More information about the cfe-commits
mailing list