Skip to content

Commit 4cb2a3a

Browse files
dinordcopybara-github
authored andcommitted
internal/any_invocable: Use std::launder unconditionally
We needed workarounds when Abseil supported C++14, and `std::launder` was only introduced in C++17. Since Abseil only supports C++17 and above now, we don't need them anymore. PiperOrigin-RevId: 728301925 Change-Id: I920988e14a4637818163f66a16b292bc5837e524
1 parent e4cef80 commit 4cb2a3a

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

absl/functional/internal/any_invocable.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,7 @@ union TypeErasedState {
181181
template <class T>
182182
T& ObjectInLocalStorage(TypeErasedState* const state) {
183183
// We launder here because the storage may be reused with the same type.
184-
#if defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606L
185184
return *std::launder(reinterpret_cast<T*>(&state->storage));
186-
#elif ABSL_HAVE_BUILTIN(__builtin_launder)
187-
return *__builtin_launder(reinterpret_cast<T*>(&state->storage));
188-
#else
189-
190-
// When `std::launder` or equivalent are not available, we rely on undefined
191-
// behavior, which works as intended on Abseil's officially supported
192-
// platforms as of Q2 2022.
193-
#if !defined(__clang__) && defined(__GNUC__)
194-
#pragma GCC diagnostic push
195-
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
196-
#endif
197-
return *reinterpret_cast<T*>(&state->storage);
198-
#if !defined(__clang__) && defined(__GNUC__)
199-
#pragma GCC diagnostic pop
200-
#endif
201-
202-
#endif
203185
}
204186

205187
// The type for functions issuing lifetime-related operations: move and dispose

0 commit comments

Comments
 (0)