aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 306ee29..4960b4b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5171,6 +5171,40 @@ classtype_has_move_assign_or_move_ctor_p (tree t, bool user_p)
return false;
}
+/* If T, a class, has a user-provided copy constructor, copy assignment
+ operator, or destructor, returns that function. Otherwise, null. */
+
+tree
+classtype_has_user_copy_or_dtor (tree t)
+{
+ if (!CLASSTYPE_LAZY_COPY_CTOR (t))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+ {
+ tree fn = *iter;
+ if (user_provided_p (fn) && copy_fn_p (fn))
+ return fn;
+ }
+
+ if (!CLASSTYPE_LAZY_COPY_ASSIGN (t))
+ for (ovl_iterator iter (get_class_binding_direct
+ (t, assign_op_identifier));
+ iter; ++iter)
+ {
+ tree fn = *iter;
+ if (user_provided_p (fn) && copy_fn_p (fn))
+ return fn;
+ }
+
+ if (!CLASSTYPE_LAZY_DESTRUCTOR (t))
+ {
+ tree fn = CLASSTYPE_DESTRUCTOR (t);
+ if (user_provided_p (fn))
+ return fn;
+ }
+
+ return NULL_TREE;
+}
+
/* Nonzero if we need to build up a constructor call when initializing an
object of this class, either because it has a user-declared constructor
or because it doesn't have a default constructor (so we need to give an
@@ -5201,6 +5235,7 @@ type_build_ctor_call (tree t)
{
tree fn = *iter;
if (!DECL_ARTIFICIAL (fn)
+ || TREE_DEPRECATED (fn)
|| DECL_DELETED_FN (fn))
return true;
}
@@ -5228,6 +5263,7 @@ type_build_dtor_call (tree t)
{
tree fn = *iter;
if (!DECL_ARTIFICIAL (fn)
+ || TREE_DEPRECATED (fn)
|| DECL_DELETED_FN (fn))
return true;
}