+2016-12-01 Jason Merrill <jason@redhat.com>
+
+ * call.c (add_function_candidate): Exclude inherited copy/move
+ ctors.
+
2016-11-29 David Malcolm <dmalcolm@redhat.com>
PR c++/77922
reason = arity_rejection (first_arg, i + remaining, len);
}
+ /* A constructor that is a direct member of a class C and has a first
+ parameter of type "reference to cv C" (including such a constructor
+ instantiated from a template) is excluded from the set of candidate
+ functions when used to construct an object of type derived from C (12.6.3
+ [class.inhctor.init]) with an argument list containing a single
+ argument. */
+ if (viable && len == 1 && parmlist && DECL_CONSTRUCTOR_P (fn)
+ && flag_new_inheriting_ctors
+ && DECL_INHERITED_CTOR (fn))
+ {
+ tree ptype = non_reference (TREE_VALUE (parmlist));
+ tree ctype = DECL_INHERITED_CTOR_BASE (fn);
+ if (same_type_ignoring_top_level_qualifiers_p (ptype, ctype))
+ {
+ viable = false;
+ reason = inherited_ctor_rejection ();
+ }
+ }
+
/* Second, for a function to be viable, its constraints must be
satisfied. */
if (flag_concepts && viable
+++ /dev/null
-// P0136 caused us to start inheriting base copy constructors.
-// { dg-do compile { target c++11 } }
-// { dg-options -fnew-inheriting-ctors }
-
-struct A { A(int); };
-struct B: public A
-{
- using A::A;
-};
-
-A a (42);
-
-B b1 (24); // inherited
-B b2 (a); // also inherited now
--- /dev/null
+// { dg-do link { target c++11 } }
+
+struct X { X(X &&); };
+struct A {
+ A() {}
+ A(const A&); // #1
+ A(A &&) = default; // #2, defined as deleted (12.8 [class.copy])
+ template<typename T> A(T &&); // #3
+ union { X x; };
+};
+struct B : A {
+ using A::A;
+ B(...) {}
+};
+
+int main() {
+ B b = A(); // calls B::B(...): #1, #2, and #3 are excluded from candidate set
+}