mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-13 14:33:45 +08:00
re PR c++/55017 ([DR 1051] [C++11] Rvalue-reference member should cause copy constructor to be deleted, but still declared)
PR c++/55017 * method.c (walk_field_subobs): Disallow copy of rvalue ref. From-SVN: r196728
This commit is contained in:
parent
cdf47df08a
commit
5275b2c7d7
@ -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.
|
||||
|
@ -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;
|
||||
|
10
gcc/testsuite/g++.dg/cpp0x/rv-copy1.C
Normal file
10
gcc/testsuite/g++.dg/cpp0x/rv-copy1.C
Normal file
@ -0,0 +1,10 @@
|
||||
// PR c++/55017
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
struct S { // { dg-error "rvalue ref" }
|
||||
int&& rr;
|
||||
S(int&& rr) : rr(static_cast<int&&>(rr)) {}
|
||||
};
|
||||
|
||||
S s1(13);
|
||||
S s2 = s1; // { dg-error "deleted" }
|
@ -1,3 +1,8 @@
|
||||
2013-03-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55017
|
||||
* testsuite/20_util/pair/piecewise2.cc (test01): Use std::move.
|
||||
|
||||
2013-03-16 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||
|
||||
PR libstdc++/56468
|
||||
|
@ -51,7 +51,8 @@ struct Default
|
||||
void test01(std::tuple<NoCon&, NoCon&&> t1,
|
||||
std::tuple<NoCon&, NoCon&&, NoCon&> t2)
|
||||
{
|
||||
std::pair<RefCheck1, RefCheck2>(std::piecewise_construct, t1, t2);
|
||||
std::pair<RefCheck1, RefCheck2>(std::piecewise_construct,
|
||||
std::move(t1), std::move(t2));
|
||||
}
|
||||
|
||||
void test02(std::tuple<> t1, std::tuple<int> t2)
|
||||
|
Loading…
Reference in New Issue
Block a user