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

    <tr>
        <th>Summary</th>
        <td>
            libc++: `rethrow_if_nested` has wrong signatures
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    The following program should be ill-formed, but is accepted when using libc++, because libc++'s `std::rethrow_if_nested` overloads have default arguments.
```C++
#include <exception>

int main()
{
    std::rethrow_if_nested(0, nullptr);
}
```

IIUC [[global.functions]/3](https://eel.is/c++draft/global.functions#3) disallows implementations to add additional default arguments to non-member functions.

`rethrow_if_nested` should be implemented as two SFINAE-constrained overloads, or a single overload that calls internal helper functions. No additional default argument should be added in either case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U01v2zAM_TX2hYjhSHacHHxI0xbopZdt50K2aFudLAX6SLZ_P8pNg3TdatBfIvX4Hkl1Vv5uv08Ig9XanpUZ4ejs6MQMfrJRS-gQlNarwboZZcYO0MUAyoPoezwGlHCe0ED0aatWXZ-xu8UoEHsRPX5YbTxkm9IHmfE9mcMwOXt-UcOLQU9o5AR7QqetkB4mcUKQOIioAwg3xhlN8EVW3mflnkLf7HABf1tlXJleR4mQ8QP-SiSVNRl_uPiXpzIBZqFMxrYZ2108zQUC6PqCIduWSZ2JWh-DS9v5e-7m_i9qtzmfnn4cIKvvyEZtO6GLIZo-kfNZfZ-xR768tlMIR5-Ss0cyRF0oTx-XEkonhkC_nyAY58QFpPIiddKDmo8aU8HEEgDBgpAy3SotCP25sinGWLOace7QwRW8uNVBsv7Ztpt5ec9M0yEI9Gzh2-PT8_5h1RNYcFR48lzbnKppHQhIM6Tx6oAwiQA9ySExBOYS5wn18QM1eLZfabqhRVGUVhlAFSbC6IXHIpctlzu-E3lQQWN7M6x8D__TOpGss7M08l6NRoTo0OfR6fZj80ZKFLuitzP9aH16f63ojL1in_qovI-Y-ltXVVPmU1vvKrYduq7kGxTNMGxEv8N1J8uGccEqnmvRofZtmiTGDJ5hgaBvGp9ctaxkrORsXbK6rupivea8Wsue9uJmI5qsKpEmXxeJR2HdmLt2odTF0ZNTK08n7OoUPglEXNIRvohhsq4dHEp0qv-5OvnVq8gXCu0i4Q_5GWc9">