[libcxx-commits] [PATCH] D97540: [libcxx] [test] Fix a test error with condvars with trivial destruction

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 26 03:30:29 PST 2021

mstorsjo created this revision.
mstorsjo added a reviewer: libc++.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.

If the destructor is trivial (_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION, the constructor always is), the compiler warns about the std::condition_variable being unused.

Add a cast to void to silence the warning about the object being unused.

  rG LLVM Github Monorepo



Index: libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp
--- libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp
+++ libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp
@@ -22,6 +22,7 @@
 int main(int, char**)
     std::condition_variable cv;
+    static_cast<void>(cv);
   return 0;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97540.326645.patch
Type: text/x-patch
Size: 452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210226/09597bec/attachment.bin>

More information about the libcxx-commits mailing list