aboutsummaryrefslogtreecommitdiff
path: root/absl/flags/internal/flag.h
diff options
context:
space:
mode:
authorGennadiy Rozental <rogeeff@google.com>2024-02-02 14:12:56 -0800
committerCopybara-Service <copybara-worker@google.com>2024-02-02 14:14:51 -0800
commit52a711fc8021b49c869581cb5dfea93580502e2c (patch)
tree7130bab50dcccb3a9b4080ec4f37085ff1ef2202 /absl/flags/internal/flag.h
parent146169f9ad357635b9cd988f976b38bcf83476e3 (diff)
downloadabseil-52a711fc8021b49c869581cb5dfea93580502e2c.tar.gz
abseil-52a711fc8021b49c869581cb5dfea93580502e2c.tar.bz2
abseil-52a711fc8021b49c869581cb5dfea93580502e2c.zip
Avoid static initializers in case of ABSL_FLAGS_STRIP_NAMES=1
PiperOrigin-RevId: 603784442 Change-Id: I3d57e5f438b276c984f5d5416889b19e7ddb501a
Diffstat (limited to 'absl/flags/internal/flag.h')
-rw-r--r--absl/flags/internal/flag.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h
index 2e6e6b87..7b056382 100644
--- a/absl/flags/internal/flag.h
+++ b/absl/flags/internal/flag.h
@@ -22,7 +22,6 @@
#include <atomic>
#include <cstring>
#include <memory>
-#include <new>
#include <string>
#include <type_traits>
#include <typeinfo>
@@ -770,7 +769,8 @@ struct FlagRegistrarEmpty {};
template <typename T, bool do_register>
class FlagRegistrar {
public:
- explicit FlagRegistrar(Flag<T>& flag, const char* filename) : flag_(flag) {
+ constexpr explicit FlagRegistrar(Flag<T>& flag, const char* filename)
+ : flag_(flag) {
if (do_register)
flags_internal::RegisterCommandLineFlag(flag_.impl_, filename);
}
@@ -783,7 +783,7 @@ class FlagRegistrar {
// Make the registrar "die" gracefully as an empty struct on a line where
// registration happens. Registrar objects are intended to live only as
// temporary.
- operator FlagRegistrarEmpty() const { return {}; } // NOLINT
+ constexpr operator FlagRegistrarEmpty() const { return {}; } // NOLINT
private:
Flag<T>& flag_; // Flag being registered (not owned).