https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90897
Bug ID: 90897 Summary: user defined conversion operators ambiguous in GCC8, but not GCC7 and GCC9 Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: h2+bugs at fsfe dot org Target Milestone: --- The rather simple example below fails to build on GCC8 in C++17 mode, but passes on GCC7, GCC9 and trunk in C++17 mode. It fails on all compilers in C++14 mode. Tested versions: g++7 (FreeBSD Ports Collection) 7.4.0 g++8 (FreeBSD Ports Collection) 8.3.0 g++9 (FreeBSD Ports Collection) 9.1.0 g++10 (FreeBSD Ports Collection) 10.0.0 20190602 (experimental) Apparently the code is correct for C++17, but GCC8 was not updated accordingly? Thanks for your help! struct S2 { constexpr S2() = default; constexpr S2(S2 const &) = default; constexpr S2(S2 &&) = default; constexpr S2& operator=(S2 const &) = default; constexpr S2& operator=(S2 &&) = default; constexpr S2 (int const &) {} }; struct S { operator int() { return 3; } operator S2() { return S2{}; } }; int main() { S2 s = static_cast<S2>(S{}); }