aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f7ce655eb19..72369244b43 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2381,22 +2381,37 @@ type_has_nontrivial_copy_init (const_tree t)
return 0;
}
-/* Returns 1 iff type T is a trivial type, as defined in [basic.types]. */
+/* Returns 1 iff type T is a trivially copyable type, as defined in
+ [basic.types] and [class]. */
bool
-trivial_type_p (const_tree t)
+trivially_copyable_p (const_tree t)
{
t = strip_array_types (CONST_CAST_TREE (t));
if (CLASS_TYPE_P (t))
- return (TYPE_HAS_TRIVIAL_DFLT (t)
- && TYPE_HAS_TRIVIAL_COPY_CTOR (t)
+ return (TYPE_HAS_TRIVIAL_COPY_CTOR (t)
&& TYPE_HAS_TRIVIAL_COPY_ASSIGN (t)
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (t));
else
return scalarish_type_p (t);
}
+/* Returns 1 iff type T is a trivial type, as defined in [basic.types] and
+ [class]. */
+
+bool
+trivial_type_p (const_tree t)
+{
+ t = strip_array_types (CONST_CAST_TREE (t));
+
+ if (CLASS_TYPE_P (t))
+ return (TYPE_HAS_TRIVIAL_DFLT (t)
+ && trivially_copyable_p (t));
+ else
+ return scalarish_type_p (t);
+}
+
/* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
bool