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

pull/1310/head
fuzzy-coats 2 years ago
parent 4a98f78682
commit e9290d3578
  1. 3
      absl/functional/internal/any_invocable.h

@ -195,7 +195,8 @@ 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 && \
(!defined(__clang__) || ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(6, 0))
return *std::launder(reinterpret_cast<T*>(&state->storage));
#elif ABSL_HAVE_BUILTIN(__builtin_launder)
return *__builtin_launder(reinterpret_cast<T*>(&state->storage));

Loading…
Cancel
Save