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
          Reporter: jose.dapena at lge dot com
  Target Milestone: ---

Created attachment 43644
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

Attached test example. In function ‘int main(int, char**)’: error: call of overloaded ‘Foo(<brace-enclosed initializer
list>)’ is ambiguous
   static Foo<std::vector<std::string>> vector({"a", "b", "c"});
                                                              ^ note: candidate: Foo<T>::Foo(const Foo<T>&) [with T =
std::vector<std::__cxx11::basic_string<char> >] <deleted>
   Foo(const Foo&) = delete;
   ^~~ note: candidate: Foo<T>::Foo(T&&) [with T =
std::vector<std::__cxx11::basic_string<char> >]
   explicit Foo(T&& x) { }
            ^~~ 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.

Reply via email to