summaryrefslogtreecommitdiff
path: root/absl/flags/commandlineflag.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags/commandlineflag.h')
-rw-r--r--absl/flags/commandlineflag.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/absl/flags/commandlineflag.h b/absl/flags/commandlineflag.h
index 7e21d05d..f2fa0897 100644
--- a/absl/flags/commandlineflag.h
+++ b/absl/flags/commandlineflag.h
@@ -108,6 +108,10 @@ class CommandLineFlag {
U u;
Read(&u.value);
+ // allow retired flags to be "read", so we can report invalid access.
+ if (IsRetired()) {
+ return absl::nullopt;
+ }
return std::move(u.value);
}