aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-05-10 22:41:23 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-05-10 22:41:23 +0100
commit1a1e427caae53ffa42d0f192b3d75045e3637539 (patch)
tree203e529f73adb76020a5f469cde0cff29dbb7be4 /libstdc++-v3
parent4b7a3ab82f1951b1ab808065cec829fecb27e206 (diff)
downloadgcc-1a1e427caae53ffa42d0f192b3d75045e3637539.zip
gcc-1a1e427caae53ffa42d0f192b3d75045e3637539.tar.gz
gcc-1a1e427caae53ffa42d0f192b3d75045e3637539.tar.bz2
PR libstdc++/81266 fix std::thread::native_handle_type test
The test uses remove_pointer because in most cases native_handle_type is a pointer to the actual type that the C++ class contains. However, for std::thread, native_handle_type is the same type as the type contained in std::thread, and so remove_pointer is not needed. On targets where pthread_t is a pointer type remove_pointer<native_handle_type> is not a no-op, instead it transforms pthread_t and causes the test to fail. The fix is to not apply remove_pointer when testing std::thread. PR libstdc++/81266 * testsuite/util/thread/all.h: Do not use remove_pointer for std::thread::native_handle_type. From-SVN: r271080
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/testsuite/util/thread/all.h8
2 files changed, 11 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1cc2970..ee7bcdc 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,9 @@
2019-05-10 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/81266
+ * testsuite/util/thread/all.h: Do not use remove_pointer for
+ std::thread::native_handle_type.
+
PR libstdc++/90397
* include/std/variant (_Variant_storage<false, Types...>::_M_storage())
(_Variant_storage<true, Types...>::_M_reset()))
diff --git a/libstdc++-v3/testsuite/util/thread/all.h b/libstdc++-v3/testsuite/util/thread/all.h
index e5794fa..2aacae4 100644
--- a/libstdc++-v3/testsuite/util/thread/all.h
+++ b/libstdc++-v3/testsuite/util/thread/all.h
@@ -25,6 +25,7 @@
#include <sstream>
#include <stdexcept>
#include <type_traits>
+#include <thread>
// C++11 only.
namespace __gnu_test
@@ -39,7 +40,12 @@ namespace __gnu_test
// Remove possible pointer type.
typedef typename test_type::native_handle_type native_handle;
- typedef typename std::remove_pointer<native_handle>::type native_type;
+ // For std::thread native_handle_type is the type of its data member,
+ // for other types it's a pointer to the type of the data member.
+ typedef typename std::conditional<
+ std::is_same<test_type, std::thread>::value,
+ native_handle,
+ typename std::remove_pointer<native_handle>::type>::type native_type;
int st = sizeof(test_type);
int snt = sizeof(native_type);