partition_alloc: fix missing basic_common_reference
in C++17.
A template specialization was introduced by: https://chromium-review.googlesource.com/c/chromium/src/+/6135992 but it exists only starting from C++20. In C++17 with Skia embedder, we get the error: third_party/externals/partition_alloc/src/partition_alloc/pointers/raw_ptr.h:1274:8: error: ‘basic_common_reference’ is not a class template Bug: 351867706 Change-Id: Id246985a497c5435663642006a5dcbd1466399e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276490 Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org> Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org> Reviewed-by: Benoit Lize <lizeb@chromium.org> Commit-Queue: Benoit Lize <lizeb@chromium.org> Cr-Commit-Position: refs/heads/main@{#1421052}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
0ae6ff9c65
commit
e6fc4c741c
@ -1255,6 +1255,7 @@ struct pointer_traits<::raw_ptr<T, Traits>> {
|
||||
}
|
||||
};
|
||||
|
||||
#if PA_BUILDFLAG(ASSERT_CPP_20)
|
||||
// Mark `raw_ptr<T>` and `T*` as having a common reference type (the type to
|
||||
// which both can be converted or bound) of `T*`. This makes them satisfy
|
||||
// `std::equality_comparable`, which allows usage like:
|
||||
@ -1267,23 +1268,20 @@ struct pointer_traits<::raw_ptr<T, Traits>> {
|
||||
// error about being unable to invoke `std::ranges::equal_to()`.
|
||||
template <typename T,
|
||||
base::RawPtrTraits Traits,
|
||||
template <typename>
|
||||
typename TQ,
|
||||
template <typename>
|
||||
typename UQ>
|
||||
template <typename> typename TQ,
|
||||
template <typename> typename UQ>
|
||||
struct basic_common_reference<raw_ptr<T, Traits>, T*, TQ, UQ> {
|
||||
using type = T*;
|
||||
};
|
||||
|
||||
template <typename T,
|
||||
base::RawPtrTraits Traits,
|
||||
template <typename>
|
||||
typename TQ,
|
||||
template <typename>
|
||||
typename UQ>
|
||||
template <typename> typename TQ,
|
||||
template <typename> typename UQ>
|
||||
struct basic_common_reference<T*, raw_ptr<T, Traits>, TQ, UQ> {
|
||||
using type = T*;
|
||||
};
|
||||
#endif // PA_BUILDFLAG(ASSERT_CPP_20)
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
Reference in New Issue
Block a user