[clang] [clang] Diagnose default arguments defined in different scopes (PR #124844)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 29 15:03:47 PST 2025
================
@@ -10960,6 +10960,10 @@ OverloadCandidateSet::BestViableFunction(Sema &S, SourceLocation Loc,
S.diagnoseEquivalentInternalLinkageDeclarations(Loc, Best->Function,
EquivalentCands);
+ // [over.match.best]/4 is checked for in Sema::ConvertArgumentsForCall,
+ // because not every function call goes through our overload resolution
+ // machinery, even if the Standard says it supposed to.
+
----------------
Endilll wrote:
We have `f(0)` test in DR tests, but I don't understand how `void f(int) {} // best candidate` would bring additional coverage. I also don't understand why we'd return `OR_Ambiguous`.
I think it's worth pointing out that when there is a redeclaration chain, only one declaration out of it is considered a candidate function for overload resolution. At least as far as I saw in the debugger while working on this.
https://github.com/llvm/llvm-project/pull/124844
More information about the cfe-commits
mailing list