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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect noexcept overload matching
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    I've made a reproducible case on compiler explorer of conditional noexcept specifier not being correctly used, GCC and MSVC use the conditional noexcept as expected.

The code gives the following error:
```
error: address of overloaded function 'CallTypeErased' does not match required type 'std::basic_string_view<char> (void *, int) noexcept'
        , _ErasedFunction( &CallTypeErased<FuncT> )
                            ^~~~~~~~~~~~~~~~~~~~~
note: in instantiation of function template specialization 'CFunctionRef<true, std::basic_string_view<char>, int>::CFunctionRef<std::basic_string_view<char> (*&)(int) noexcept>' requested here
        CFunctionRef<true, std::string_view, int> FuncRef = FuncPtr;
                                                            ^
note: candidate template ignored: could not match 'std::basic_string_view<char> (void *, int)' against 'std::basic_string_view<char> (void *, int) noexcept'
    static RetT CallTypeErased( void* pFunction, Args... Arguments ) noexcept( IsNoexcept )
```

https://godbolt.org/z/z4hKjx5xa

Changing the offending line to noexcept( true ) still fails, but a plain noexcept works, so it looks like the error is with the conditional noexcept expression.

Changing the line from taking the address of a static member function with conditional noexcept to being a static member function that is called and returns a conditionally noexcept lambda which decays into a function pointer works. So it appears the error is at the member function level not everywhere.

The work around also works on GCC and MSVC as expected.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vdtu2zgQ_Rr5haigSJZlP-ghddIiWOxi0QZ9DUbiSGJMkVqSsuN-_Q5pW7G9CVKgWEWxeJuZwzO3SvN9-RClxRZZDxwZMIOD0XysRSWR1WCRacVq3Q9ComH4MkhtaKAbWlRcOKEVSKY0vtQ4OGYHrEUj6ITSjlUoVEsHjcHayT0b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