<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59363>59363</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Non-conformant behavior regarding multiple function declarations with default arguments
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Endilll
      </td>
    </tr>
</table>

<pre>
    [[over.match.best]/4](https://eel.is/c++draft/over.match.best#general-4) includes an example with ill-formed code that Clang fails to diagnose:
```cpp
namespace A {
  extern "C" void f(int = 5);
}
namespace B {
  extern "C" void f(int = 5);
}

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

void use() {
  f(3); // OK, default argument was not used for viability
  f(); // error: found default argument twice
}
```
For the reference, [[dcl.fct.default]/4](https://eel.is/c++draft/dcl.fct.default#4) states that "declarations that inhabit different scopes have completely distinct sets of default arguments."
There's also a related [CWG418](https://wg21.link/cwg418) and a [D139429](https://reviews.llvm.org/D139429) that adds a test for it.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE2P4zYM_TXyhRjDoZ0PH3xIJk0PBdpLgZ4ZibLVKlIg0cnOvy8Uz253MnvqAoGE0NTTe-QTKWc3BuZBrQ9qfaxolimm4ZdgnPe-Okfztnw6xBun-kKip_rMWdT6qPDUPbbdJHLNqt0rPCk8MfvaZYUnrfCg8GASWVF4ekbAduTAifxLp7AHF7SfDWegAPyFLlfPcHcygfP-xcZ0YQM6GgaZSODVUxjBkvMZJIJxNIaYuZBojqrZq02z_PT1ukQCXThfSTPsQW0PSxCAvwinAArxVSHCLToDVuHOBQHVHmGtsFfte7raHp_BDj8PtqxzdmGEfVHQ7u23rCV8eA4v6-OCObPCXSnhd0zKre1yGyxtgT9-U_gKhi3NXoDSOF84CNwpQ4hSYAzYmODm6Oy8k7fvsT5CcUoxqXYPNs7BfMaUu9P8rPJrR5a_p5hAJobElhMHzYXcYjWjfW211O-w_8NqzwjYPiyWhYTzYiCFaFh7SiQuhvegCxOdnYBx9sFKIOt45QwT3Rh0LKYU9m9gXBYXtEBmyRDtpxLkWiEuSv-cOLHCbQbyOQJBYk_Cpqh9_evXbrX7kbT7iKvau_BPUXcfSxb2QMEAlYPHVdt32P_oZOKb43uuvb9d6phGhaev2dgvOsmYDATCWR4td1JXZmhN3_ZU8bDabJu22_b9rpoGbMisO9tuu443tsGu35Dd7Npm022sNV3lBmwQV9hsVtu2XW1rpNWaejprY9u-2VjVNXwh578xqlzOMw_rvt20lacz-_yYMoi6POti9BSDcDCliOtjlYZy9OU8j1l1jXdZ_pNXiRPPw-8xvOgYyqCgIHDmiW4uJkg8UjLlDV1mL65MFTsHXZoOHwzwmDWf2ljNyQ8f6zs6meZzreNF4amweN9erin-zbr476Gv-PIh8d8AAAD__9m7qA8">