[libcxx-commits] [libcxx] [libc++] Verify forward_list self-merging is a no-op (PR #129985)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 6 01:01:19 PST 2025


================
@@ -109,5 +110,12 @@ int main(int, char**) {
   }
 #endif
 
+  { // Make sure self-merging does nothing.
+    int a[] = {1, 2, 3, 4, 5};
+    std::forward_list<int> c(a, a + sizeof(a) / sizeof(a[0]));
+    c.merge(c);
+    assert((c == std::forward_list<int>(a, a + sizeof(a) / sizeof(a[0]))));
----------------
philnik777 wrote:

```suggestion
    assert(c == std::forward_list<int>(a, a + sizeof(a) / sizeof(a[0])));
```

https://github.com/llvm/llvm-project/pull/129985


More information about the libcxx-commits mailing list