8373207: Make DeferredStatic class template constant initializable

Reviewed-by: jsjolen, stefank, iwalulya
This commit is contained in:
Kim Barrett 2025-12-10 00:07:28 +00:00
parent 1ae4a6c43e
commit 7f9951a934

View File

@ -35,7 +35,7 @@
// object must be explicitly initialized before use. This avoids problems
// resulting from the unspecified initialization time and ordering between
// different objects that comes from using undeferred objects (the so-called
// "Static Initialization Order Fiasco).
// "Static Initialization Order Fiasco").
//
// Once initialized, the object is never destroyed. This avoids similar issues
// with the timing and ordering of destruction on normal program exit.
@ -53,7 +53,7 @@ class DeferredStatic {
public:
NONCOPYABLE(DeferredStatic);
DeferredStatic()
constexpr DeferredStatic()
DEBUG_ONLY(: _initialized(false)) {
// Do not construct value, on purpose.
}