[clang] [Clang] prevent null explicit object argument from being deduced (PR #104328)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 15 13:14:58 PDT 2024
================
@@ -4462,6 +4462,9 @@ TemplateDeductionResult Sema::DeduceTemplateArguments(
ParamTypesForArgChecking.push_back(ParamType);
if (ParamIdx == 0 && HasExplicitObject) {
+ if (ObjectType.isNull())
+ return TemplateDeductionResult::InvalidExplicitArguments;
----------------
mizvekov wrote:
If we already diagnosed it, or if we are in the process of diagnosing it anyway regardless of any details this function will provide, that would be the most sensible return code.
Any other return code assumes that it is providing error information that will help diagnose the problem down the line.
But we are currently bad at diagnosing deduction failures anyway, and a lot of these deduction error codes are presently ignored, so there are probably no consequences yet.
https://github.com/llvm/llvm-project/pull/104328
More information about the cfe-commits
mailing list