aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-25 15:51:44 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-25 15:51:44 -0400
commit5e24286319abceaee8846843c89c5c6332d25e51 (patch)
tree3bd3821df070c4649761cd59fd8facb8757ddba2
parent636e368d17f866add3270e482e722c335b453c98 (diff)
downloadgcc-5e24286319abceaee8846843c89c5c6332d25e51.zip
gcc-5e24286319abceaee8846843c89c5c6332d25e51.tar.gz
gcc-5e24286319abceaee8846843c89c5c6332d25e51.tar.bz2
re PR c++/46696 ([C++0x] Implicit copy constructor can't construct array of subtype with user-defined copy constructor.)
PR c++/46696 * typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN. From-SVN: r174226
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted29.C20
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 236ca6d..72e62d7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 69b25d3..5fbb765 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 10b928f..833d52e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..5fcf5b0c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted29.C
@@ -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;
+}