@@ -6019,6 +6019,10 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t,
return t;
}
+ /* Shortcut trivial copy constructor/op=. */
+ if (call_expr_nargs (t) == 2 && trivial_fn_p (fun))
+ return convert_from_reference (get_nth_callarg (t, 1));
+
/* If in direct recursive call, optimize definition search. */
if (old_call != NULL && old_call->fundef->decl == fun)
new_call.fundef = old_call->fundef;
new file mode 100644
@@ -0,0 +1,14 @@
+// PR c++/47503
+// { dg-options "-std=c++0x -fno-elide-constructors" }
+
+struct A
+{
+ int i;
+ A ();
+};
+
+struct B
+{
+ A a;
+ B (A &aa) : a (aa) { }
+};