summaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 00:50:45 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-30 00:50:45 +0000
commit0f16033eb5a6958bbd90e80ac693e10d37439c78 (patch)
tree85c05d67287f91a060fe0e69e71f48258e217270 /gcc/cp/tree.c
parentab8002def2756caef8dab23e0fd27c446dbd343e (diff)
downloadgcc-0f16033eb5a6958bbd90e80ac693e10d37439c78.tar.gz
* 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
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