diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-06-18 01:19:03 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-06-18 01:19:03 +0000 |
commit | 18e0461ad72dcf6ec93cd3b1df7bf1b5a30b10b7 (patch) | |
tree | 6701a5d1593a161c06b46593d66e58031904324e /lib/Sema/SemaTemplateDeduction.cpp | |
parent | e665d6929e11796620ff799bc0186ebd747bfc76 (diff) |
Accept no-return stripping conversions for pointer type arguments after
deducing template parameter types. Recently Clang began enforcing the
more strict checking that the argument type and the deduced function
parameter type (after substitution) match, but that only consideres
qualification conversions.
One problem with this patch is that we check noreturn conversions and
qualification conversions independently. If a valid conversion would
require *both*, perhaps interleaved with each other, it will be
rejected. If this actually occurs (I'm not yet sure it does) and is in
fact a problem (I'm not yet sure it is), there is a FIXME to implement
more intelligent conversion checking.
However, this step at least allows Clang to resume accepting valid code
we're seeing in the wild.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133327 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index b5e9c25d85..dcb4ff2860 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -2371,9 +2371,16 @@ CheckOriginalCallArgDeduction(Sema &S, Sema::OriginalCallArg OriginalArg, // - The transformed A can be another pointer or pointer to member // type that can be converted to the deduced A via a qualification // conversion. + // + // Also allow conversions which merely strip [[noreturn]] from function types + // (recursively) as an extension. + // FIXME: Currently, this doesn't place nicely with qualfication conversions. bool ObjCLifetimeConversion = false; + QualType ResultTy; if ((A->isAnyPointerType() || A->isMemberPointerType()) && - S.IsQualificationConversion(A, DeducedA, false, ObjCLifetimeConversion)) + (S.IsQualificationConversion(A, DeducedA, false, + ObjCLifetimeConversion) || + S.IsNoReturnConversion(A, DeducedA, ResultTy))) return false; |