summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mike Hommey <mhommey@mozilla.com>2023-05-17 13:35:35 +0900
committerGravatar Mike Hommey <mh@glandium.org>2023-05-18 05:45:34 +0900
commit486db28adc2c48c255fffbfde1d59415f4762b71 (patch)
tree6aa3d5cc71eb096a333c315ff34215fb42bfa67b
parentc8b33b0191a2db8364cacf94b267ea8a3f20ad83 (diff)
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
-rw-r--r--absl/functional/internal/any_invocable.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/functional/internal/any_invocable.h b/absl/functional/internal/any_invocable.h
index d41b7e56..634984ca 100644
--- a/absl/functional/internal/any_invocable.h
+++ b/absl/functional/internal/any_invocable.h
@@ -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));