From b56cbdd23834a65682c0b46f367f8679e83bc894 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 18 Sep 2020 15:55:15 -0700 Subject: Abseil LTS 20200923 What's New: * `absl::StatusOr` has been released. See our [blog post](https://abseil.io/blog/2020-091021-status) for more information. * Abseil Flags reflection interfaces have been released. * Abseil Flags memory usage has been significantly optimized. * Abseil now supports a "hardened" build mode. This build mode enables runtime checks that guard against programming errors that may lead to security vulnerabilities. Notable Fixes: * Sanitizer dynamic annotations like `AnnotateRWLockCreate` that are also defined by the compiler sanitizer implementation are no longer also defined by Abseil. * Sanitizer macros are now prefixed with `ABSL_` to avoid naming collisions. * Sanitizer usage is now automatically detected and no longer requires macros like `ADDRESS_SANITIZER` to be defined on the command line. Breaking Changes: * Abseil no longer contains a `dynamic_annotations` library. Users using a supported build system (Bazel or CMake) are unaffected by this, but users manually specifying link libraries may get an error about a missing linker input. Baseline: 7680a5f8efe32de4753baadbd63e74e59d95bac1 Cherry picks: None --- absl/types/optional.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'absl/types/optional.h') diff --git a/absl/types/optional.h b/absl/types/optional.h index 2025e29f..61540cfd 100644 --- a/absl/types/optional.h +++ b/absl/types/optional.h @@ -136,10 +136,10 @@ class optional : private optional_internal::optional_data, constexpr optional(nullopt_t) noexcept {} // NOLINT(runtime/explicit) // Copy constructor, standard semantics - optional(const optional& src) = default; + optional(const optional&) = default; // Move constructor, standard semantics - optional(optional&& src) = default; + optional(optional&&) = default; // Constructs a non-empty `optional` direct-initialized value of type `T` from // the arguments `std::forward(args)...` within the `optional`. @@ -412,11 +412,11 @@ class optional : private optional_internal::optional_data, // // If you need myOpt->foo in constexpr, use (*myOpt).foo instead. const T* operator->() const { - assert(this->engaged_); + ABSL_HARDENING_ASSERT(this->engaged_); return std::addressof(this->data_); } T* operator->() { - assert(this->engaged_); + ABSL_HARDENING_ASSERT(this->engaged_); return std::addressof(this->data_); } @@ -425,17 +425,17 @@ class optional : private optional_internal::optional_data, // Accesses the underlying `T` value of an `optional`. If the `optional` is // empty, behavior is undefined. constexpr const T& operator*() const& { - return ABSL_ASSERT(this->engaged_), reference(); + return ABSL_HARDENING_ASSERT(this->engaged_), reference(); } T& operator*() & { - assert(this->engaged_); + ABSL_HARDENING_ASSERT(this->engaged_); return reference(); } constexpr const T&& operator*() const && { - return absl::move(reference()); + return ABSL_HARDENING_ASSERT(this->engaged_), absl::move(reference()); } T&& operator*() && { - assert(this->engaged_); + ABSL_HARDENING_ASSERT(this->engaged_); return std::move(reference()); } @@ -444,7 +444,7 @@ class optional : private optional_internal::optional_data, // Returns false if and only if the `optional` is empty. // // if (opt) { - // // do something with opt.value(); + // // do something with *opt or opt->; // } else { // // opt is empty. // } -- cgit v1.2.3