class.c (classtype_has_move_assign_or_move_ctor): Declare.

* class.c (classtype_has_move_assign_or_move_ctor): Declare.
	(add_implicitly_declared_members): Use it.
	(type_has_move_constructor, type_has_move_assign): Merge into ...
	(classtype_has_move_assign_or_move_ctor): ... this new function.
	* cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.

From-SVN: r250305
This commit is contained in:
Nathan Sidwell 2017-07-18 12:05:12 +00:00 committed by Nathan Sidwell
parent 694dd0e408
commit 6b8e738ef0
3 changed files with 17 additions and 29 deletions

View file

@ -1,3 +1,11 @@
2017-07-18 Nathan Sidwell <nathan@acm.org>
* class.c (classtype_has_move_assign_or_move_ctor): Declare.
(add_implicitly_declared_members): Use it.
(type_has_move_constructor, type_has_move_assign): Merge into ...
(classtype_has_move_assign_or_move_ctor): ... this new function.
* cp-tree.h (type_has_move_constructor, type_has_move_assign): Delete.
2017-07-17 Volker Reichelt <v.reichelt@netcologne.de>
* parser.c (cp_parser_decl_specifier_seq): Add fix-it hints for

View file

@ -150,6 +150,7 @@ static void build_base_fields (record_layout_info, splay_tree, tree *);
static void check_methods (tree);
static void remove_zero_width_bit_fields (tree);
static bool accessible_nvdtor_p (tree);
static bool classtype_has_move_assign_or_move_ctor (tree);
/* Used by find_flexarrays and related functions. */
struct flexmems_t;
@ -3384,7 +3385,7 @@ add_implicitly_declared_members (tree t, tree* access_decls,
bool move_ok = false;
if (cxx_dialect >= cxx11 && CLASSTYPE_LAZY_DESTRUCTOR (t)
&& !TYPE_HAS_COPY_CTOR (t) && !TYPE_HAS_COPY_ASSIGN (t)
&& !type_has_move_constructor (t) && !type_has_move_assign (t))
&& !classtype_has_move_assign_or_move_ctor (t))
move_ok = true;
/* [class.ctor]
@ -5456,38 +5457,19 @@ type_has_virtual_destructor (tree type)
return (dtor && DECL_VIRTUAL_P (dtor));
}
/* Returns true iff class T has a move constructor. */
/* Returns true iff class T has move assignment or move constructor. */
bool
type_has_move_constructor (tree t)
static bool
classtype_has_move_assign_or_move_ctor (tree t)
{
if (CLASSTYPE_LAZY_MOVE_CTOR (t))
{
gcc_assert (COMPLETE_TYPE_P (t));
lazily_declare_fn (sfk_move_constructor, t);
}
gcc_assert (!CLASSTYPE_LAZY_MOVE_CTOR (t)
&& !CLASSTYPE_LAZY_MOVE_ASSIGN (t));
if (!CLASSTYPE_METHOD_VEC (t))
return false;
for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
for (ovl_iterator iter (lookup_fnfields_slot_nolazy
(t, ctor_identifier)); iter; ++iter)
if (move_fn_p (*iter))
return true;
return false;
}
/* Returns true iff class T has a move assignment operator. */
bool
type_has_move_assign (tree t)
{
if (CLASSTYPE_LAZY_MOVE_ASSIGN (t))
{
gcc_assert (COMPLETE_TYPE_P (t));
lazily_declare_fn (sfk_move_assignment, t);
}
for (ovl_iterator iter (lookup_fnfields_slot_nolazy
(t, cp_assignment_operator_id (NOP_EXPR)));
iter; ++iter)

View file

@ -6023,8 +6023,6 @@ extern tree default_init_uninitialized_part (tree);
extern bool trivial_default_constructor_is_constexpr (tree);
extern bool type_has_constexpr_default_constructor (tree);
extern bool type_has_virtual_destructor (tree);
extern bool type_has_move_constructor (tree);
extern bool type_has_move_assign (tree);
extern bool classtype_has_user_move_assign_or_move_ctor_p (tree);
extern bool type_build_ctor_call (tree);
extern bool type_build_dtor_call (tree);