Commit 1a1e427c by Jonathan Wakely Committed by Jonathan Wakely

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
parent 4b7a3ab8
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()))
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment