[libcxx-commits] [libcxx] [libc++] Guard call_once against operator hijacking. (PR #128054)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Mar 1 02:52:13 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
----------------
mordante wrote:
Thanks for the info. I've applied Louis' suggestion.
https://github.com/llvm/llvm-project/pull/128054
More information about the libcxx-commits
mailing list