[Bug c++/84849] Ambiguous resolution of braze initializer list to a class with explicit copy/move constructors
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 13 18:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84849
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-03-13
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jose Dapena Paz from comment #0)
> For a template class with explicit copy and move constructors,
Those aren't copy and move constructors.
Reduced:
struct X
{
X(const char*) { }
};
template <typename T>
class Foo {
public:
template <typename... Args>
explicit Foo(Args&&... args);
explicit Foo(const T&);
explicit Foo(T&&) { }
Foo(const Foo&) = delete;
Foo& operator=(const Foo&) = delete;
~Foo() = default;
};
int main() {
Foo<X> v({"a"});
}
vs.cc: In function 'int main()':
vs.cc:22:17: error: call of overloaded 'Foo(<brace-enclosed initializer list>)'
is ambiguous
Foo<X> v({"a"});
^
vs.cc:15:3: note: candidate: 'Foo<T>::Foo(const Foo<T>&) [with T = X]'
<deleted>
Foo(const Foo&) = delete;
^~~
vs.cc:13:12: note: candidate: 'Foo<T>::Foo(T&&) [with T = X]'
explicit Foo(T&&) { }
^~~
vs.cc:12:12: note: candidate: 'Foo<T>::Foo(const T&) [with T = X]'
explicit Foo(const T&);
^~~
More information about the Gcc-bugs
mailing list