[clang] [clang] Diagnose default arguments defined in different scopes (PR #124844)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 01:35:53 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.
+
----------------
cor3ntin wrote:

do we have test for something like that

```
namespace A {
    extern "C" void f(long = 0); // viable candidate
}
namespace B {
    extern "C" void f(long = 0); // viable candidate
}

using A::f;
using B::f;

void f(int) {} // best candidate

void g() {
    f(0); // should not diagnose
}
```

https://github.com/llvm/llvm-project/pull/124844


More information about the cfe-commits mailing list