https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104383
Bug ID: 104383
Summary: User-defined conversion is preferred over standard-one
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This example
```
#include <initializer_list>
struct IntSimilar { constexpr IntSimilar(int) {} };
constexpr int f(int) { return 1; }
constexpr int f(std::initializer_list<IntSimilar>) { return 2; }
int main() {
static_assert( f({0}) == 1 );
}
```
is accepted by Clang and MSVC. It looks right according to the standard saying
"a standard conversion sequence is a better conversion sequence than a
user-defined conversion sequence"
https://timsong-cpp.github.io/cppwp/n4861/over.ics.rank#2.1
But GCC selects the other overload. Demo: https://gcc.godbolt.org/z/3Ghvn98xr