[libcxx-commits] [PATCH] D95972: [libc++] Use init_priority(100) when possible
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 8 08:26:34 PST 2021
Quuxplusone added subscribers: EricWF, Quuxplusone.
Quuxplusone added inline comments.
Comment at: libcxx/src/experimental/memory_resource.cpp:79
-// When compiled in C++14 this initialization should be a constant expression.
-// Only in C++11 is "init_priority" needed to ensure initialization order.
-#if _LIBCPP_STD_VER > 11
-ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
+_LIBCPP_SAFE_STATIC ResourceInitHelper res_init;
> @arthur.j.odwyer Pinging you here since you wrote that code. Does this LGTY?
@ldionne: I just copied this line from experimental/... oh wait, this //is// experimental/... yeah, this was added by @ericwf in https://github.com/llvm/llvm-project/commit/4efaa30934e81 . IIUC, if we're sure this file is always compiled as C++14 at this point, then I don't even think it matters what we put here. In C++20 we should mark this variable `constinit`.
However, whatever you decide on, it'd be useful if you could add a review comment to D89057 .
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits