[scudo] Fix use of ScopedDisableMemoryTagChecks in test

GitOrigin-RevId: 99ec78c0feded25a2b01dd5ae822b37a70b63c17
diff --git a/tests/wrappers_cpp_test.cpp b/tests/wrappers_cpp_test.cpp
index 64a0917..24fbf27 100644
--- a/tests/wrappers_cpp_test.cpp
+++ b/tests/wrappers_cpp_test.cpp
@@ -11,6 +11,7 @@
 
 #include <atomic>
 #include <condition_variable>
+#include <memory>
 #include <mutex>
 #include <thread>
 #include <vector>
@@ -111,7 +112,9 @@
 #if !SCUDO_ANDROID
   // TODO: Investigate why libc sometimes crashes with tag missmatch in
   // __pthread_clockjoin_ex.
-  scudo::ScopedDisableMemoryTagChecks NoTags;
+  std::unique_ptr<scudo::ScopedDisableMemoryTagChecks> NoTags;
+  if (scudo::systemSupportsMemoryTagging())
+    NoTags = std::make_unique<scudo::ScopedDisableMemoryTagChecks>();
 #endif
   Ready = false;
   std::thread Threads[32];