mirror of git://gcc.gnu.org/git/gcc.git
class.c (add_implicitly_declared_members): Update move conditions.
N3203 * class.c (add_implicitly_declared_members): Update move conditions. From-SVN: r181445
This commit is contained in:
parent
a8e237782f
commit
830dea94f2
|
@ -1,5 +1,9 @@
|
|||
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.
|
||||
|
||||
|
|
|
@ -2721,6 +2721,13 @@ add_implicitly_declared_members (tree t,
|
|||
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))
|
||||
{
|
||||
|
@ -2758,7 +2765,7 @@ add_implicitly_declared_members (tree 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;
|
||||
}
|
||||
|
||||
|
@ -2771,7 +2778,7 @@ add_implicitly_declared_members (tree t,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
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
|
||||
|
|
|
@ -31,6 +31,7 @@ class tstring : public std::basic_string<char>
|
|||
public:
|
||||
tstring() : std::basic_string<char>() {}
|
||||
tstring(tstring&& s) : std::basic_string<char>(std::move(s)) {}
|
||||
tstring& operator=(tstring&& s) = default;
|
||||
};
|
||||
|
||||
void test01()
|
||||
|
|
|
@ -31,6 +31,7 @@ class twstring : public std::basic_string<wchar_t>
|
|||
public:
|
||||
twstring() : std::basic_string<wchar_t>() {}
|
||||
twstring(twstring&& s) : std::basic_string<wchar_t>(std::move(s)) {}
|
||||
twstring& operator=(twstring&&) = default;
|
||||
};
|
||||
|
||||
void test01()
|
||||
|
|
|
@ -199,6 +199,7 @@ namespace __gnu_test
|
|||
struct NoexceptMoveConsClass
|
||||
{
|
||||
NoexceptMoveConsClass(NoexceptMoveConsClass&&) noexcept(true);
|
||||
NoexceptMoveConsClass& operator=(NoexceptMoveConsClass&&) = default;
|
||||
};
|
||||
|
||||
struct ExceptMoveConsClass
|
||||
|
@ -220,6 +221,7 @@ namespace __gnu_test
|
|||
|
||||
struct NoexceptMoveAssignClass
|
||||
{
|
||||
NoexceptMoveAssignClass(NoexceptMoveAssignClass&&) = default;
|
||||
NoexceptMoveAssignClass&
|
||||
operator=(NoexceptMoveAssignClass&&) noexcept(true);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue