- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15k
Closed
Closed
Copy link
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Milestone
Description
#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 #83575
Would someone please have a look?
Metadata
Metadata
Assignees
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Type
Projects
Status
Done