mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-21 13:49:45 +08:00
re PR c++/46736 ([c++0x] move constructor is not implicitly deleted when it should be)
PR c++/46736 * decl.c (cp_finish_decl): Complain about an implicitly deleted method defaulted outside the class. * method.c (maybe_explain_implicit_delete): Don't check DECL_INITIAL. From-SVN: r167601
This commit is contained in:
parent
6a68a5c397
commit
f484252507
@ -1,3 +1,10 @@
|
||||
2010-12-08 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/46736
|
||||
* decl.c (cp_finish_decl): Complain about an implicitly deleted
|
||||
method defaulted outside the class.
|
||||
* method.c (maybe_explain_implicit_delete): Don't check DECL_INITIAL.
|
||||
|
||||
2010-12-07 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* rtti.c: Don't include assert.h.
|
||||
|
@ -6094,7 +6094,9 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
|
||||
{
|
||||
/* An out-of-class default definition is defined at
|
||||
the point where it is explicitly defaulted. */
|
||||
if (DECL_INITIAL (decl) == error_mark_node)
|
||||
if (DECL_DELETED_FN (decl))
|
||||
maybe_explain_implicit_delete (decl);
|
||||
else if (DECL_INITIAL (decl) == error_mark_node)
|
||||
synthesize_method (decl);
|
||||
}
|
||||
else
|
||||
|
@ -1318,8 +1318,7 @@ maybe_explain_implicit_delete (tree decl)
|
||||
/* If decl is a clone, get the primary variant. */
|
||||
decl = DECL_ORIGIN (decl);
|
||||
gcc_assert (DECL_DELETED_FN (decl));
|
||||
if (DECL_DEFAULTED_FN (decl)
|
||||
&& DECL_INITIAL (decl) == NULL_TREE)
|
||||
if (DECL_DEFAULTED_FN (decl))
|
||||
{
|
||||
/* Not marked GTY; it doesn't need to be GC'd or written to PCH. */
|
||||
static htab_t explained_htab;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-12-08 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/46736
|
||||
* g++.dg/cpp0x/defaulted21.C: New.
|
||||
|
||||
2010-12-08 Wei Guozhi <carrot@google.com>
|
||||
|
||||
PR target/46631
|
||||
|
20
gcc/testsuite/g++.dg/cpp0x/defaulted21.C
Normal file
20
gcc/testsuite/g++.dg/cpp0x/defaulted21.C
Normal file
@ -0,0 +1,20 @@
|
||||
// PR c++/46736
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
struct U {
|
||||
U();
|
||||
U(U const&);
|
||||
};
|
||||
|
||||
struct X {
|
||||
U const u;
|
||||
X();
|
||||
X(X&&);
|
||||
};
|
||||
|
||||
X::X(X&&)=default; // { dg-error "implicitly deleted" }
|
||||
// { dg-error "does not have a move constructor" "" { target *-*-* } 15 }
|
||||
|
||||
X f() {
|
||||
return X();
|
||||
}
|
Loading…
Reference in New Issue
Block a user