Here the used base<int>::operator= gets into the list of foo's bindings for
operator=, but it shouldn't make the copy ctor deleted.
* class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
op= brought in by a using-declaration.
From-SVN: r269442
+2019-03-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/89381 - implicit copy and using-declaration.
+ * class.c (classtype_has_move_assign_or_move_ctor_p): Don't consider
+ op= brought in by a using-declaration.
+
2019-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/87148
for (ovl_iterator iter (get_class_binding_direct
(t, assign_op_identifier));
iter; ++iter)
- if ((!user_p || !DECL_ARTIFICIAL (*iter)) && move_fn_p (*iter))
+ if ((!user_p || !DECL_ARTIFICIAL (*iter))
+ && DECL_CONTEXT (*iter) == t
+ && move_fn_p (*iter))
return true;
return false;
--- /dev/null
+// PR c++/89381
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct base
+{
+ base() { }
+ base(const base&) { }
+ base(base&&) { }
+ base& operator=(const base&) { return *this; }
+ base& operator=(base&&) { return *this; }
+};
+
+struct foo : base<int>
+{
+ using base<int>::base;
+ using base<int>::operator=;
+};
+
+//using workaround = decltype(foo{*static_cast<foo const*>(0)});
+
+struct bar
+{
+ bar& operator=(foo ve)
+ {
+ value = ve;
+ return *this;
+ }
+
+ foo value;
+};
+
+int main()
+{
+ foo a;
+ foo b{a};
+}