From 0f16033eb5a6958bbd90e80ac693e10d37439c78 Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 30 Jun 2010 00:50:45 +0000 Subject: * class.c (type_has_virtual_destructor): New. * cp-tree.h: Declare it. * semantics.c (trait_expr_value): Use it. * call.c (build_over_call): Only give warnings with tf_warning. * name-lookup.c (pop_scope): Handle NULL_TREE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161578 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/tree.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'gcc/cp/tree.c') 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 -- cgit v1.2.1