Now that we have is_trivially_copyable ...
Update the docs and fix a TODO in <atomic>.
I asked Doug Gregor recently about the __is_location_invariant trait
that he used in our std::tr1::function and std::function
implementations and he confirmed that in C++11
std::is_trivially_copyable is a better test.
Ville pointed out on IRC that we might also be able to use it in
<bits/stl_algobase.h> instead of __is_trivial but I haven't
investigated that properly.
Tested x86_64-linux, committed to trunk.
commit 27ae8432c1af48d9fbc15754bf93285dcfbfdbc3
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Thu Oct 9 18:22:23 2014 +0100
* doc/xml/manual/status_cxx2011.xml: Update.
* doc/html/manual/status.html: Regenerate.
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 108de36..c4b4457 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -811,16 +811,10 @@ particular release.
<entry/>
</row>
<row>
- <?dbhtml bgcolor="#B0B0B0" ?>
<entry>20.9.4.3</entry>
<entry>Type properties</entry>
- <entry>Partial</entry>
- <entry>Missing is_trivially_copyable,
- is_trivially_constructible, is_trivially_default_constructible,
- is_trivially_copy_constructible, is_trivially_move_constructible,
- is_trivially_assignable, is_trivially_default_assignable,
- is_trivially_copy_assignable, is_trivially_move_assignable
- </entry>
+ <entry>Y</entry>
+ <entry/>
</row>
<row>
<entry>20.9.5</entry>
commit 4b6c1c0a6cb99c6fc7a8da5407fffed797a0bc29
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Thu Oct 9 13:42:57 2014 +0100
PR libstdc++/63322
* include/std/atomic (atomic): Add assertion for trivially copyable.
* testsuite/29_atomics/atomic/60695.cc: Adjust line number.
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index be7d0be..85dc252 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -163,7 +163,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
_Tp _M_i;
- // TODO: static_assert(is_trivially_copyable<_Tp>::value, "");
+ static_assert(__is_trivially_copyable(_Tp),
+ "std::atomic requires a trivially copyable type");
static_assert(sizeof(_Tp) > 0,
"Incomplete or zero-sized types are not supported");
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
b/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
index 27c0c8f..10c5e3a 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/60695.cc
@@ -27,4 +27,4 @@ struct X {
char stuff[0]; // GNU extension, type has zero size
};
-std::atomic<X> a; // { dg-error "not supported" "" { target *-*-* } 168 }
+std::atomic<X> a; // { dg-error "not supported" "" { target *-*-* } 169 }
commit cfb875df06d5691b5d81de489d07c0da106da517
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Thu Oct 9 13:47:04 2014 +0100
PR libstdc++/61909
* include/std/functional (__is_location_invariant): Treat all
trivially copyable types as location invariant.
diff --git a/libstdc++-v3/include/std/functional
b/libstdc++-v3/include/std/functional
index 15247bf..bed1eea 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1743,11 +1743,12 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
/**
* Trait identifying "location-invariant" types, meaning that the
* address of the object (or any of its members) will not escape.
- * Also implies a trivial copy constructor and assignment operator.
+ * Trivially copyable types are location-invariant and users can
+ * specialize this trait for other types.
*/
template<typename _Tp>
struct __is_location_invariant
- : __or_<is_pointer<_Tp>, is_member_pointer<_Tp>>::type
+ : is_trivially_copyable<_Tp>::type
{ };
class _Undefined_class;