]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Helgrind regtest: use older C++ dialect for bug392331.cpp
authorPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 10 Sep 2025 19:53:22 +0000 (21:53 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 10 Sep 2025 19:53:22 +0000 (21:53 +0200)
Old versions of GCC (like 6.3) claim some C++17 support but
apparently not CTAD
https://en.cppreference.com/w/cpp/language/class_template_argument_deduction.html
So, go backwards and explicitly give the std::mutex template type for the locks.

helgrind/tests/bug392331.cpp

index ff26883b76ef72004304a64457992e12278791f9..bd6cc5a236abe45d63b5becf2835898e396b995f 100644 (file)
@@ -16,7 +16,7 @@ bool processed = false;
 void worker_thread()
 {
     // Wait until main() sends data
-    std::unique_lock lk(m);
+    std::unique_lock<std::mutex> lk(m);
     cv.wait(lk, []{return ready;});
  
     // after the wait, we own the lock.
@@ -40,7 +40,7 @@ int main()
     data = "Example data";
     // send data to the worker thread
     {
-        std::lock_guard lk(m);
+        std::lock_guard<std::mutex> lk(m);
         ready = true;
         std::cout << "main() signals data ready for processing\n";
     }
@@ -48,7 +48,7 @@ int main()
  
     // wait for the worker
     {
-        std::unique_lock lk(m);
+        std::unique_lock<std::mutex> lk(m);
         cv.wait(lk, []{return processed;});
     }
     std::cout << "Back in main(), data = " << data << '\n';