Skip to content

Commit 2dc30d9

Browse files
yuxuanchen1997facebook-github-bot
authored andcommitted
Fix: Avoid passing std::vector<bool, Alloc>::reference to fmt (facebookincubator#13876)
Summary: Pull Request resolved: facebookincubator#13876 The expression `visited[node]` is of `std::vector<bool, Alloc>::reference` type, and some versions of `fmt` library doesn't handle it well under libc++ (P1850535374), especially when custom allocator is present. Since we are just comparing equality (no need for mutation) here, casting it to bool is the most straightforward fix. Since `std::vector<bool>::const_reference` is just `bool`, I suspected that using `vector::at() const` will suffice here. However, that's not the case since the vector itself is non-const, causing overload resolution to choose the best overload, which is the non-const one, returning the `reference`, and the conversion becomes unavoidable again. Reviewed By: vitaut, skrueger Differential Revision: D77275081 fbshipit-source-id: fe6c5828accbd544e9c46818ca434cafecf09423
1 parent 597fbea commit 2dc30d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

velox/functions/lib/QuantileDigest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ bool QuantileDigest<T, Allocator>::validateDigest() const {
741741
root_,
742742
[&free, &visited](int32_t node) {
743743
VELOX_CHECK_EQ(free.count(node), 0);
744-
VELOX_CHECK_EQ(visited[node], false);
744+
VELOX_CHECK_EQ(bool(visited[node]), false);
745745
visited[node] = true;
746746

747747
return true;

0 commit comments

Comments
 (0)