about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/nix/src/libexpr/primops.cc9
-rw-r--r--third_party/nix/src/tests/lang/eval-okay-sort.nix (renamed from third_party/nix/src/tests/lang/disabled/eval-okay-sort.nix)0
2 files changed, 5 insertions, 4 deletions
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index 34d659675b..7819dd4b13 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -1600,9 +1600,10 @@ static void prim_sort(EvalState& state, const Pos& pos, Value** args,
   state.forceList(*args[1], pos);
 
   // Copy of the input list which can be sorted in place.
-  auto outlist = new NixList(*args[1]->list);
+  v.type = tList;
+  v.list = new NixList(*args[1]->list);
 
-  std::for_each(outlist->begin(), outlist->end(),
+  std::for_each(v.list->begin(), v.list->end(),
                 [&](Value* val) { state.forceValue(*val); });
 
   auto comparator = [&](Value* a, Value* b) {
@@ -1612,8 +1613,8 @@ static void prim_sort(EvalState& state, const Pos& pos, Value** args,
       return CompareValues()(a, b);
     }
 
-    Value vTmp1;
-    Value vTmp2;
+    Value vTmp1{};
+    Value vTmp2{};
     state.callFunction(*args[0], *a, vTmp1, pos);
     state.callFunction(vTmp1, *b, vTmp2, pos);
     return state.forceBool(vTmp2, pos);
diff --git a/third_party/nix/src/tests/lang/disabled/eval-okay-sort.nix b/third_party/nix/src/tests/lang/eval-okay-sort.nix
index 8299c3a4a3..8299c3a4a3 100644
--- a/third_party/nix/src/tests/lang/disabled/eval-okay-sort.nix
+++ b/third_party/nix/src/tests/lang/eval-okay-sort.nix