Commit 486db28a by Mike Hommey Committed by Mike Hommey

Use UB impl of launder on when using clang < 8 and c++17

libstdc++'s definition of std::launder places it behind a check for
__builtin_launder, which is not available before clang 8.

Fixes: #1309
parent c8b33b01
......@@ -197,7 +197,7 @@ union TypeErasedState {
template <class T>
T& ObjectInLocalStorage(TypeErasedState* const state) {
// We launder here because the storage may be reused with the same type.
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && __cpp_lib_launder >= 201606L
return *std::launder(reinterpret_cast<T*>(&state->storage));
#elif ABSL_HAVE_BUILTIN(__builtin_launder)
return *__builtin_launder(reinterpret_cast<T*>(&state->storage));
......
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