File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -259,17 +259,6 @@ struct CastInfo<To, const PointerUnion<PTs...>>
259259 CastInfo<To, PointerUnion<PTs...>>> {
260260};
261261
262- // The default implementation of isPresent() for nullable types returns true
263- // if the active member is not the first one, even if its value is nullptr.
264- // Override the default behavior to return false for all possible null values.
265- template <typename ... PTs>
266- struct ValueIsPresent <PointerUnion<PTs...>,
267- std::enable_if_t <IsNullable<PointerUnion<PTs...>>>> {
268- using Union = PointerUnion<PTs...>;
269- static bool isPresent (const Union &V) { return static_cast <bool >(V); }
270- static Union &unwrapValue (Union &V) { return V; }
271- };
272-
273262// Teach SmallPtrSet that PointerUnion is "basically a pointer", that has
274263// # low bits available = min(PT1bits,PT2bits)-1.
275264template <typename ...PTs>
Original file line number Diff line number Diff line change @@ -614,12 +614,11 @@ template <typename T> struct ValueIsPresent<std::optional<T>> {
614614 static inline decltype (auto ) unwrapValue(std::optional<T> &t) { return *t; }
615615};
616616
617- // If something is "nullable" then we just compare it to nullptr to see if it
618- // exists.
617+ // If something is "nullable" then we just cast it to bool to see if it exists.
619618template <typename T>
620619struct ValueIsPresent <T, std::enable_if_t <IsNullable<T>>> {
621620 using UnwrappedType = T;
622- static inline bool isPresent (const T &t) { return t != T ( nullptr ); }
621+ static inline bool isPresent (const T &t) { return static_cast < bool >(t ); }
623622 static inline decltype (auto ) unwrapValue(T &t) { return t; }
624623};
625624
You can’t perform that action at this time.
0 commit comments