2011-11-17 Jason Merrill <jason@redhat.com>
+ N3203
+ * class.c (add_implicitly_declared_members): Update move
+ conditions.
+
PR c++/51137
* class.c (build_base_path): Don't do calculation in templates.
int cant_have_const_cctor,
int cant_have_const_assignment)
{
+ bool move_ok = false;
+
+ if (cxx_dialect >= cxx0x && !CLASSTYPE_DESTRUCTORS (t)
+ && !TYPE_HAS_COPY_CTOR (t) && !TYPE_HAS_COPY_ASSIGN (t)
+ && !type_has_move_constructor (t) && !type_has_move_assign (t))
+ move_ok = true;
+
/* Destructor. */
if (!CLASSTYPE_DESTRUCTORS (t))
{
TYPE_HAS_COPY_CTOR (t) = 1;
TYPE_HAS_CONST_COPY_CTOR (t) = !cant_have_const_cctor;
CLASSTYPE_LAZY_COPY_CTOR (t) = 1;
- if (cxx_dialect >= cxx0x && !type_has_move_constructor (t))
+ if (move_ok)
CLASSTYPE_LAZY_MOVE_CTOR (t) = 1;
}
TYPE_HAS_COPY_ASSIGN (t) = 1;
TYPE_HAS_CONST_COPY_ASSIGN (t) = !cant_have_const_assignment;
CLASSTYPE_LAZY_COPY_ASSIGN (t) = 1;
- if (cxx_dialect >= cxx0x && !type_has_move_assign (t))
+ if (move_ok)
CLASSTYPE_LAZY_MOVE_ASSIGN (t) = 1;
}
+2011-11-17 Jason Merrill <jason@redhat.com>
+
+ * testsuite/21_strings/basic_string/cons/char/moveable2.cc
+ (tstring): Add defaulted move assignment.
+ * testsuite/21_strings/basic_string/cons/wchar_t/moveable2.cc
+ (tstring): Add defaulted move assignment.
+ * testsuite/util/testsuite_tr1.h (NoexceptMoveConsClass): Add
+ defaulted move assignment operator.
+ (NoexceptMoveAssignClass): Add defaulted move constructor.
+
2011-11-17 Jonathan Wakely <jwakely.gcc@gmail.com>
* doc/xml/manual/status_cxx2011.xml: Status of piecewise construction
public:
tstring() : std::basic_string<char>() {}
tstring(tstring&& s) : std::basic_string<char>(std::move(s)) {}
+ tstring& operator=(tstring&& s) = default;
};
void test01()
public:
twstring() : std::basic_string<wchar_t>() {}
twstring(twstring&& s) : std::basic_string<wchar_t>(std::move(s)) {}
+ twstring& operator=(twstring&&) = default;
};
void test01()
struct NoexceptMoveConsClass
{
NoexceptMoveConsClass(NoexceptMoveConsClass&&) noexcept(true);
+ NoexceptMoveConsClass& operator=(NoexceptMoveConsClass&&) = default;
};
struct ExceptMoveConsClass
struct NoexceptMoveAssignClass
{
+ NoexceptMoveAssignClass(NoexceptMoveAssignClass&&) = default;
NoexceptMoveAssignClass&
operator=(NoexceptMoveAssignClass&&) noexcept(true);
};