re PR c++/63959 (G++ misreports volatile int as trivially copyable)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Thu, 20 Nov 2014 21:51:04 +0000 (23:51 +0200)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 20 Nov 2014 21:51:04 +0000 (16:51 -0500)
PR c++/63959
* tree.c (trivially_copyable_p): Check for CP_TYPE_VOLATILE_P.

From-SVN: r217893

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C
libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc

index 3111050..2c98a71 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-20  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/63959
+       * tree.c (trivially_copyable_p): Check for CP_TYPE_VOLATILE_P.
+
 2014-11-20  Trevor Saunders  <tsaunders@mozilla.com>
 
        * cp-objcp-common.c: Use hash_table instead of htab.
index 4502273..f8506f5 100644 (file)
@@ -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
index f558538..c866373 100644 (file)
@@ -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));
index c21a5c4..c861355 100644 (file)
@@ -47,6 +47,8 @@ void test01()
 
   static_assert(test_property<is_trivially_copyable, 
                int>(true), "");
+  static_assert(test_property<is_trivially_copyable,
+               volatile int>(false), "");
   static_assert(test_property<is_trivially_copyable, 
                TType>(true), "");
   static_assert(test_property<is_trivially_copyable,