[libcxx-commits] [PATCH] D152327: [libc++] Fix an exception safety issue in `forward_list` and add tests.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 8 11:26:11 PDT 2023


Mordante added a comment.

Nice catch! Thanks for working on this.



================
Comment at: libcxx/test/std/containers/exception_safety_helpers.h:36
+
+  // Defined to silence GCC warnings. For test purposes, only copy construction is considered `created_by_copying`.
+  ThrowingCopy& operator=(const ThrowingCopy& other) {
----------------
Would deleting the function have the same effect?


================
Comment at: libcxx/test/std/containers/exception_safety_helpers.h:75-76
+    assert(T::created_by_copying == 1);
+    assert(T::destroyed == 0);
+  }
+}
----------------
Alternatively there is the `TEST_VALIDATE_EXCEPTION` macro which I use in the formatting tests
`libcxx//data/src/llvm/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp` for example.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152327/new/

https://reviews.llvm.org/D152327



More information about the libcxx-commits mailing list