Commit d0c43345 by Abseil Team Committed by Gennadiy Rozental

Export of internal Abseil changes

--
daabc2a08b55696424add36e8fd6ed0ab397dadc by Derek Mauro <dmauro@google.com>:

Internal change

PiperOrigin-RevId: 326713082
GitOrigin-RevId: daabc2a08b55696424add36e8fd6ed0ab397dadc
Change-Id: Ibe91394988bc3bcfaae7ac16bdc1e9b5dfd16588
parent c6b3f2cf
...@@ -159,16 +159,19 @@ inline Dest bit_cast(const Source& source) { ...@@ -159,16 +159,19 @@ inline Dest bit_cast(const Source& source) {
return dest; return dest;
} }
// NOTE: This overload is only picked if the requirements of bit_cast are not // NOTE: This overload is only picked if the requirements of bit_cast are
// met. It is therefore UB, but is provided temporarily as previous versions of // not met. It is therefore UB, but is provided temporarily as previous
// this function template were unchecked. Do not use this in new code. // versions of this function template were unchecked. Do not use this in
// new code.
template < template <
typename Dest, typename Source, typename Dest, typename Source,
typename std::enable_if< typename std::enable_if<
!internal_casts::is_bitcastable<Dest, Source>::value, int>::type = 0> !internal_casts::is_bitcastable<Dest, Source>::value,
int>::type = 0>
ABSL_DEPRECATED( ABSL_DEPRECATED(
"absl::bit_cast type requirements were violated. Update the types being " "absl::bit_cast type requirements were violated. Update the types "
"used such that they are the same size and are both TriviallyCopyable.") "being used such that they are the same size and are both "
"TriviallyCopyable.")
inline Dest bit_cast(const Source& source) { inline Dest bit_cast(const Source& source) {
static_assert(sizeof(Dest) == sizeof(Source), static_assert(sizeof(Dest) == sizeof(Source),
"Source and destination types should have equal sizes."); "Source and destination types should have equal sizes.");
......
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