[llvm] Fixed build with C++20 standard (PR #169772)
A. Jiang via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 02:20:06 PST 2025
================
@@ -267,7 +267,11 @@ class iterator_adaptor_base
return *static_cast<DerivedT *>(this);
}
using BaseT::operator-;
- difference_type operator-(const DerivedT &RHS) const {
+ difference_type operator-(const DerivedT &RHS) const
+#ifdef __cpp_concepts
+ requires(bool(BaseT::IsRandomAccess))
+#endif
+ {
----------------
frederick-vs-ja wrote:
How about also constrain this in C++17?
```suggestion
template <bool Enabled = bool(BaseT::IsRandomAccess), std::enable_if_t<Enabled, int> = 0>
difference_type operator-(const DerivedT &RHS) const {
```
https://github.com/llvm/llvm-project/pull/169772
More information about the llvm-commits
mailing list