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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 25 08:38:31 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
----------------
ldionne wrote:

I don't think we want to introduce `TEST_USE_FROZEN_CXX03_HEADERS`. Instead, we should mark the test as `XFAIL: CXX03-FROZEN-HEADERS-FIXME` (or whatever it is). I know this means the whole test is going to be excluded, however the idea behind `CXX03-FROZEN-HEADERS-FIXME` is that these annotations will (almost) all get removed at some point before we actually flip that switch. And if I've misunderstood and the plan is actually to carry this debt forever in our test suite, I think we need to factor that into our decision for making that switch in the first place. CC @philnik777 

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


More information about the libcxx-commits mailing list