https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84849
Bug ID: 84849 Summary: Ambiguous resolution of braze initializer list to a class with explicit copy/move constructors Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jose.dapena at lge dot com Target Milestone: --- Created attachment 43644 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43644&action=edit Test case For a template class with explicit copy and move constructors, passing a std::vector of std::string using initializer list syntax fails because of geing ambiguous. Attached test example. main.cc: In function ‘int main(int, char**)’: main.cc:22:62: error: call of overloaded ‘Foo(<brace-enclosed initializer list>)’ is ambiguous static Foo<std::vector<std::string>> vector({"a", "b", "c"}); ^ main.cc:14:3: note: candidate: Foo<T>::Foo(const Foo<T>&) [with T = std::vector<std::__cxx11::basic_string<char> >] <deleted> Foo(const Foo&) = delete; ^~~ main.cc:12:12: note: candidate: Foo<T>::Foo(T&&) [with T = std::vector<std::__cxx11::basic_string<char> >] explicit Foo(T&& x) { } ^~~ main.cc:11:12: note: candidate: Foo<T>::Foo(const T&) [with T = std::vector<std::__cxx11::basic_string<char> >] explicit Foo(const T& x) { } This test case works properly on clang (it resolves to the move constructor.