From 5b776e85e79639d132e8d016e28bc8099319b2ed Mon Sep 17 00:00:00 2001 From: Ivan Koptiev Date: Tue, 30 Jun 2026 15:25:46 +0300 Subject: [PATCH] fix(thrift): add TEnumIterator::operator== for libc++ 22 libc++ >= 19 implements std::map's range constructor with `first == last`. arrow's vendored thrift TEnumIterator only declared operator!=, so std::map(TEnumIterator,...) in the generated parquet_types.cpp failed to compile under the LLVM 22 toolchain. Add the matching operator==. Co-Authored-By: Claude Opus 4.8 (1M context) --- third_party/thrift/lib/cpp/src/thrift/Thrift.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/third_party/thrift/lib/cpp/src/thrift/Thrift.h b/third_party/thrift/lib/cpp/src/thrift/Thrift.h index 8a86b748acfa..359faa304768 100644 --- a/third_party/thrift/lib/cpp/src/thrift/Thrift.h +++ b/third_party/thrift/lib/cpp/src/thrift/Thrift.h @@ -61,6 +61,15 @@ class TEnumIterator { return (ii_ != n_); } + // libc++ >= 19 implements std::map's range constructor with `first == last`; TEnumIterator only + // declared operator!=, so std::map(TEnumIterator,...) failed to compile under the + // LLVM 22 toolchain ("invalid operands to binary expression"). Provide the matching ==. + bool operator==(const TEnumIterator& end) const { + THRIFT_UNUSED_VARIABLE(end); + assert(end.n_ == -1); + return (ii_ == n_); + } + std::pair operator*() const { return std::make_pair(enums_[ii_], names_[ii_]); } private: