https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117257

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to qurong from comment #0)
> This causes an error in clang, but GCC didn't report the error.
> 
> Compiler Explorer link: https://godbolt.org/z/4sbb3qEqq

This link is using libstdc++ for both cases, so it isn't likely to be a
libstdc++ bug.

I think the difference is how GCC and Clang handle the _Complex keyword, which
is not in standard C++ so there's no requirement for them to behave the same.

Reduced:

template<typename T> struct complex { };

template<> struct complex<float> {
    using CF = _Complex float;
    complex(float, float = 0) { }
    complex(CF) { }
    explicit complex(const complex<double>&) { }
};

template<> struct complex<double> {
    using CF = _Complex double;
    complex(double = 0, double = 0) { }
    complex(CF) { }
    explicit complex(const complex<float>&) { }
};

int main()
{
    complex<double> c({1.0, 0.0});
}

Reply via email to