named_thread: fix bugs in std::forward usage

Fix few misused threads and other bugs.
This commit is contained in:
Nekotekina 2021-03-01 18:02:25 +03:00
parent d788b12a8e
commit bbf52f3cea
5 changed files with 111 additions and 211 deletions

View file

@ -10,6 +10,7 @@ namespace stx
#pragma GCC diagnostic push
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wundefined-var-template"
#pragma GCC diagnostic ignored "-Wundefined-internal"
#endif
#endif
@ -21,7 +22,7 @@ namespace stx
template <typename T, typename U>
constexpr bool is_same_ptr() noexcept
{
#if !defined(_MSC_VER) && !defined(__clang__)
#ifdef _MSC_VER
return true;
#else
if constexpr (std::is_void_v<T> || std::is_void_v<U> || std::is_same_v<T, U>)
@ -30,14 +31,14 @@ namespace stx
}
else if constexpr (std::is_convertible_v<U*, T*>)
{
const auto u = std::addressof(sample<U>);
const volatile void* x = u;
constexpr auto u = std::addressof(sample<U>);
constexpr volatile void* x = u;
return static_cast<T*>(u) == x;
}
else if constexpr (std::is_convertible_v<T*, U*>)
{
const auto t = std::addressof(sample<T>);
const volatile void* x = t;
constexpr auto t = std::addressof(sample<T>);
constexpr volatile void* x = t;
return static_cast<U*>(t) == x;
}
else