re PR c++/46696 ([C++0x] Implicit copy constructor can't construct array of subtype...
authorJason Merrill <jason@redhat.com>
Wed, 25 May 2011 19:51:44 +0000 (15:51 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 25 May 2011 19:51:44 +0000 (15:51 -0400)
PR c++/46696
* typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN.

From-SVN: r174226

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted29.C [new file with mode: 0644]

index 236ca6d..72e62d7 100644 (file)
@@ -1,5 +1,8 @@
 2011-05-25  Jason Merrill  <jason@redhat.com>
 
+       PR c++/46696
+       * typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN.
+
        PR c++/47184
        * parser.c (cp_parser_parameter_declaration): Recognize
        list-initialization.
index 69b25d3..5fbb765 100644 (file)
@@ -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.  */
index 10b928f..833d52e 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-25  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/defaulted29.C: New.
+
        * g++.dg/cpp0x/initlist51.C: New.
 
 2011-05-25  Janis Johnson  <janisjo@codesourcery.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted29.C b/gcc/testsuite/g++.dg/cpp0x/defaulted29.C
new file mode 100644 (file)
index 0000000..5fcf5b0
--- /dev/null
@@ -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;
+}