diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-07-18 00:14:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-07-18 00:14:59 +0000 |
commit | b251302dd52249c49ba6527fcd013396deef22cf (patch) | |
tree | afb8d6651d94c07de98eba83422e5cd8f126fd9f /lib/Sema/SemaTemplateDeduction.cpp | |
parent | 1638f2e8263df93b9fa055a12cc3f0968b9682d8 (diff) |
When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index dcf878115e..9500ec3219 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -2436,6 +2436,16 @@ CheckOriginalCallArgDeduction(Sema &S, Sema::OriginalCallArg OriginalArg, Qualifiers AQuals = A.getQualifiers(); Qualifiers DeducedAQuals = DeducedA.getQualifiers(); + + // Under Objective-C++ ARC, the deduced type may have implicitly been + // given strong lifetime. If so, update the original qualifiers to + // include this strong lifetime. + if (S.getLangOpts().ObjCAutoRefCount && + DeducedAQuals.getObjCLifetime() == Qualifiers::OCL_Strong && + AQuals.getObjCLifetime() == Qualifiers::OCL_None) { + AQuals.setObjCLifetime(Qualifiers::OCL_Strong); + } + if (AQuals == DeducedAQuals) { // Qualifiers match; there's nothing to do. } else if (!DeducedAQuals.compatiblyIncludes(AQuals)) { |