summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/method.c13
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 04eab4a67d1..28b110c68a4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2013-03-16 Jason Merrill <jason@redhat.com>
+ PR c++/55017
+ * method.c (walk_field_subobs): Disallow copy of rvalue ref.
+
PR c++/55240
* parser.c (parsing_nsdmi): New.
* semantics.c (outer_automatic_var_p): Check it.
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index ff29b596892..55c7e50d308 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1115,6 +1115,19 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
"initialize %q+#D", field);
}
}
+ else if (sfk == sfk_copy_constructor)
+ {
+ /* 12.8p11b5 */
+ if (TREE_CODE (mem_type) == REFERENCE_TYPE
+ && TYPE_REF_IS_RVALUE (mem_type))
+ {
+ if (diag)
+ error ("copying non-static data member %q#D of rvalue "
+ "reference type", field);
+ if (deleted_p)
+ *deleted_p = true;
+ }
+ }
if (!CLASS_TYPE_P (mem_type))
continue;