about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-13T23·28+0100
committertazjin <mail@tazj.in>2020-07-13T23·51+0000
commitd94690b537f8f83fead41cfb6a2594f045e9569d (patch)
tree10e3568a4a2094d693278b9ba5709dc67fb8478a
parent785ca363167983b04f3d1f17c2d1d464969a1a50 (diff)
fix(3p/nix/libexpr): Fix post-increment operator in BindingsIterator r/1287
We accidentally returned the incremented iterator in the
post-increment, this fixes it.

Paired-With: Luke Granger-Brown <git@lukegb.com>
Paired-With: Vincent Ambo <mail@tazj.in>
Paired-With: Perry Lorier <isomer@tvl.fyi>
Change-Id: I36c79eb56359bb12a78ad3489e7d7d2eb2053510
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1140
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r--third_party/nix/src/libexpr/attr-set.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.cc b/third_party/nix/src/libexpr/attr-set.cc
index c5cfbf3caf5f..5ef63a129cdc 100644
--- a/third_party/nix/src/libexpr/attr-set.cc
+++ b/third_party/nix/src/libexpr/attr-set.cc
@@ -23,12 +23,13 @@ BindingsIterator& BindingsIterator::operator++() {
 }
 
 BindingsIterator BindingsIterator::operator++(int) {
+  auto old = *this;
   std::visit(util::overloaded{
                  [](AttributeMap::iterator& iter) { iter++; },
                  [](AttributeVector::iterator& iter) { iter++; },
              },
              _iterator);
-  return *this;
+  return old;
 }
 
 bool BindingsIterator::operator==(const BindingsIterator& other) const {