From 486db28adc2c48c255fffbfde1d59415f4762b71 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 17 May 2023 13:35:35 +0900 Subject: 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 --- absl/functional/internal/any_invocable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'absl') 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 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(&state->storage)); #elif ABSL_HAVE_BUILTIN(__builtin_launder) return *__builtin_launder(reinterpret_cast(&state->storage)); -- cgit v1.2.3