[libcxx-commits] [libcxx] 4adb4bc - [libcxx] [test] Fix a test error with condvars with trivial destruction

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 2 10:37:39 PST 2021


Author: Martin Storsjö
Date: 2021-03-02T20:34:22+02:00
New Revision: 4adb4bca05750a1c85dd931a72a6fece030fa01e

URL: https://github.com/llvm/llvm-project/commit/4adb4bca05750a1c85dd931a72a6fece030fa01e
DIFF: https://github.com/llvm/llvm-project/commit/4adb4bca05750a1c85dd931a72a6fece030fa01e.diff

LOG: [libcxx] [test] Fix a test error with condvars with trivial destruction

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.

Differential Revision: https://reviews.llvm.org/D97540

Added: 
    

Modified: 
    libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp b/libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp
index a734ce9d6b42..5291e119eef3 100644
--- a/libcxx/test/std/thread/thread.condition/thread.condition.condvar/default.pass.cpp
+++ b/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;
 }


        


More information about the libcxx-commits mailing list