commit 3ac89bd9f5f81b4d3ff293b337e7e9163d3402dd
Author: Jason Merrill <jason@redhat.com>
Date: Wed May 25 12:05:03 2011 -0400
PR c++/46696
* typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN.
@@ -6748,7 +6748,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
/* Allow array assignment in compiler-generated code. */
else if (!current_function_decl
- || !DECL_ARTIFICIAL (current_function_decl))
+ || !DECL_DEFAULTED_FN (current_function_decl))
{
/* This routine is used for both initialization and assignment.
Make sure the diagnostic message differentiates the context. */
new file mode 100644
@@ -0,0 +1,20 @@
+// PR c++/46696
+// { dg-options -std=c++0x }
+
+struct A
+{
+ A& operator= (A const&);
+};
+
+struct B
+{
+ A ar[1];
+ B& operator= (B const&) = default;
+};
+
+int main()
+{
+ B x;
+ B y;
+ y = x;
+}