[libcxx-commits] [libcxx] [libc++] Guard call_once against operator hijacking. (PR #128054)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 25 09:35:51 PST 2025


================
@@ -253,7 +254,20 @@ int main(int, char**)
         std::call_once(f2, std::move(rq));
         assert(rq.rv_called == 1);
     }
+    {
+      std::once_flag flag;
+      auto f = [](const operator_hijacker&) {};
+      std::call_once(flag, f, operator_hijacker{});
+    }
+
 #endif // TEST_STD_VER >= 11
 
-  return 0;
+#ifndef TEST_USE_FROZEN_CXX03_HEADERS
----------------
philnik777 wrote:

Yeah, I don't think we should introduce this macro. The plan is to remove all the annotations one way or another and then flip to the frozen headers.

https://github.com/llvm/llvm-project/pull/128054


More information about the libcxx-commits mailing list