From: Ville Voutilainen Date: Thu, 20 Nov 2014 21:51:04 +0000 (+0200) Subject: re PR c++/63959 (G++ misreports volatile int as trivially copyable) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=75bda2e8134c013bc3d02b78e5b8b34022961985;p=gcc.git re PR c++/63959 (G++ misreports volatile int as trivially copyable) PR c++/63959 * tree.c (trivially_copyable_p): Check for CP_TYPE_VOLATILE_P. From-SVN: r217893 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3111050cb62..2c98a7103d1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Ville Voutilainen + + PR c++/63959 + * tree.c (trivially_copyable_p): Check for CP_TYPE_VOLATILE_P. + 2014-11-20 Trevor Saunders * cp-objcp-common.c: Use hash_table instead of htab. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 4502273fb57..f8506f512bc 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3206,7 +3206,7 @@ trivially_copyable_p (const_tree t) && !TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) && TYPE_HAS_TRIVIAL_DESTRUCTOR (t)); else - return scalarish_type_p (t); + return !CP_TYPE_VOLATILE_P (t) && scalarish_type_p (t); } /* Returns 1 iff type T is a trivial type, as defined in [basic.types] and diff --git a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C index f558538694c..c8663739e7d 100644 --- a/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C +++ b/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C @@ -33,3 +33,6 @@ SA(__is_trivially_constructible(int,double)); SA(!__is_trivially_constructible(int,B)); SA(!__is_trivially_constructible(D)); + +SA(__is_trivially_copyable(int)); +SA(!__is_trivially_copyable(volatile int)); diff --git a/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc index c21a5c46772..c8613550ce6 100644 --- a/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc +++ b/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc @@ -47,6 +47,8 @@ void test01() static_assert(test_property(true), ""); + static_assert(test_property(false), ""); static_assert(test_property(true), ""); static_assert(test_property