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

    <tr>
        <th>Summary</th>
        <td>
            [libc++] error: call to constructor of 'std::complex<float>' is ambiguous
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

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

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

<pre>
    ```#include <complex>

typedef std::complex<float> Fcx;

struct S {
 S() {}
    S(const S&) {}
    template <class T> operator T() { return 0; }
} s;

int main(void)
{
    std::complex<float> *p00 = new std::complex<float>(s, s);
}
```

This program is accepted by libstdc++ but rejected by libc++
```<source>:13:36: error: call to constructor of 'std::complex<float>' is ambiguous
   13 | std::complex<float> *p00 = new std::complex<float>(s, s);
      | ^ ~~~~
/opt/compiler-explorer/clang-trunk-20240805/bin/../include/c++/v1/complex:422:43: note: candidate constructor
  422 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) : __re_(__re), __im_(__im) {}
      | ^
/opt/compiler-explorer/clang-trunk-20240805/bin/../include/c++/v1/complex:424:43: note: candidate constructor
  424 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR complex(__from_builtin_tag, _Complex float __v)
      | ^
1 error generated.
Compiler returned: 1
```

https://godbolt.org/z/6Ph1W7bq5
We found this from a downstream C++ library comparison test.

I think this is due to merge https://github.com/llvm/llvm-project/pull/83575
Would someone please have a look?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8lVFvozgQxz_N5GXUCMYhhAceElJ0le5uq22lvTdksJP4ajBnm2x7D_3sJxOSRlVVaU93G0WAhmHmPz97xtw5te-kzCHZQLKd8cEfjM15q7TshOWz2oiXHJbR9CemukYPQiKwojFtr-UzsFuIthCtT1f_0kshd-i8ALYG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