* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167601
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
{
/* 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
/* 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;
+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
--- /dev/null
+// 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();
+}