================
@@ -642,7 +642,9 @@ class LineJoiner {
         return 0;
       const auto N = MergedLines + LinesToBeMerged;
       // Check if there is even a line after the inner result.
-      if (std::distance(I, E) <= N)
+      auto Distance = std::distance(I, E);
+      assert(Distance >= 0);
+      if (static_cast<decltype(N)>(Distance) <= N)
----------------
HazardyKnusperkeks wrote:

```suggestion
      if (auto Distance = std::distance(I, E); 
static_cast<decltype(N)>(Distance) <= N)
```
Don't need the assert.
Or use `std::cmp_less_equal`.

https://github.com/llvm/llvm-project/pull/172627
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to