diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-04-17 08:45:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-04-17 08:45:07 +0000 |
commit | 19a41f161b87b8827a53d8a3f3dbbf4d884ff7d6 (patch) | |
tree | fc430169651142f4f97b10e047edd51ab6607b48 /clang/lib/Sema/SemaOverload.cpp | |
parent | 045c6c5b404243983a119914a847f151194537c0 (diff) | |
download | bcm5719-llvm-19a41f161b87b8827a53d8a3f3dbbf4d884ff7d6.tar.gz bcm5719-llvm-19a41f161b87b8827a53d8a3f3dbbf4d884ff7d6.zip |
Fix PR15291: noreturn adjustment in overload resolution for function templates, from Alexander Zinenko!
llvm-svn: 179680
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index dec4938622b..4576a0eab2c 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -9134,17 +9134,19 @@ private: = S.DeduceTemplateArguments(FunctionTemplate, &OvlExplicitTemplateArgs, TargetFunctionType, Specialization, - Info)) { + Info, /*InOverloadResolution=*/true)) { // FIXME: make a note of the failed deduction for diagnostics. (void)Result; return false; } - // Template argument deduction ensures that we have an exact match. + // Template argument deduction ensures that we have an exact match or + // compatible pointer-to-function arguments that would be adjusted by ICS. // This function template specicalization works. Specialization = cast<FunctionDecl>(Specialization->getCanonicalDecl()); - assert(TargetFunctionType - == Context.getCanonicalType(Specialization->getType())); + assert(S.isSameOrCompatibleFunctionType( + Context.getCanonicalType(Specialization->getType()), + Context.getCanonicalType(TargetFunctionType))); Matches.push_back(std::make_pair(CurAccessFunPair, Specialization)); return true; } @@ -9409,7 +9411,8 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, TemplateDeductionInfo Info(ovl->getNameLoc()); if (TemplateDeductionResult Result = DeduceTemplateArguments(FunctionTemplate, &ExplicitTemplateArgs, - Specialization, Info)) { + Specialization, Info, + /*InOverloadResolution=*/true)) { // FIXME: make a note of the failed deduction for diagnostics. (void)Result; continue; |