https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83264
Bug ID: 83264 Summary: std::initializer_list with a single element selects the wrong overload Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rustamabd at gmail dot com Target Milestone: --- Consider the following: #include <iostream> #include <initializer_list> using namespace std; template<typename T> struct A { A(int) { cout << "A(int)\n"; } A(std::initializer_list<T>) { cout << "A(initializer_list)\n"; } }; struct UdfInt { UdfInt(int) {} }; int main() { A<UdfInt> obj({ 10 }); return 0; } GCC (any version) prints "A(initializer_list)". Other compilers (clang, MSVC) print "A(int)". According to [dcl.init.list]/3.9, a single-element braced-init-list should be unwrapped which means the A(int) overload is the best viable alternative since the other one needs a user-defined conversion.