Skip to content

Commit a06c893

Browse files
authored
[libc++abi] Make once_flag constinit in cxa_exception_storage (#124627)
This makes it clearer that initialization of this global variable is taking place at compile-time, reducing the likelihood of static initialization order fiasco.
1 parent e89e7c4 commit a06c893

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxxabi/src/cxa_exception_storage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extern "C" {
5656
namespace __cxxabiv1 {
5757
namespace {
5858
std::__libcpp_tls_key key_;
59-
std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
59+
constinit std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
6060

6161
void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
6262
__free_with_fallback(p);

0 commit comments

Comments
 (0)