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 236ca6d090a7041e6829401f736621b3b76434b3..72e62d75f70acff4dfc3ca90b13228f5ed5a34b4 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 69b25d39645405acd9e72809537a854ad6ac927e..5fbb765767e915ca9426bd53d72f7eb44139e6d4 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 10b928f3b793195467bc01bd46a5407476053e59..833d52eb63542ea03da2303a1d5a9130103bff3b 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;
+}