https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84849

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Ambiguous resolution of     |Ambiguous resolution of
                   |braze initializer list to a |braze initializer list to a
                   |class with explicit         |class with explicit
                   |copy/move constructors      |constructors

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Further reduced:


struct X {
  X(int) { }
};

struct Foo {
  explicit Foo(const X&);
  explicit Foo(X&&) { }
};

int main() {
  Foo v({1});
}


vs.cc: In function 'int main()':
vs.cc:11:12: error: call of overloaded 'Foo(<brace-enclosed initializer list>)'
is ambiguous
   Foo v({1});
            ^
vs.cc:7:12: note: candidate: 'Foo::Foo(X&&)'
   explicit Foo(X&&) { }
            ^~~
vs.cc:6:12: note: candidate: 'Foo::Foo(const X&)'
   explicit Foo(const X&);
            ^~~
vs.cc:5:8: note: candidate: 'constexpr Foo::Foo(const Foo&)'
 struct Foo {
        ^~~
vs.cc:5:8: note: candidate: 'constexpr Foo::Foo(Foo&&)'

Reply via email to