+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
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;
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]
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)
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);