diff options
Diffstat (limited to 'absl/status/statusor.h')
-rw-r--r-- | absl/status/statusor.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/absl/status/statusor.h b/absl/status/statusor.h index c051fbb3..d6ebdc2b 100644 --- a/absl/status/statusor.h +++ b/absl/status/statusor.h @@ -106,7 +106,13 @@ class BadStatusOrAccess : public std::exception { // Returned StatusOr objects may not be ignored. template <typename T> +#if ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) +// TODO(b/176172494): ABSL_MUST_USE_RESULT should expand to the more strict +// [[nodiscard]]. For now, just use [[nodiscard]] directly when it is available. +class [[nodiscard]] StatusOr; +#else class ABSL_MUST_USE_RESULT StatusOr; +#endif // ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) // absl::StatusOr<T> // |