summaryrefslogtreecommitdiff
path: root/absl/types
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-09-25 11:29:22 -0700
committerGravatar Mark Barolak <mbar@google.com>2019-09-25 15:12:18 -0400
commit502efe6d7841bff82b1aeef5500491fe9a48c635 (patch)
tree55d08454a8d92f086cd6397c8527093f402b3eaa /absl/types
parentccdd1d57b6386ebc26fb0c7d99b604672437c124 (diff)
Export of internal Abseil changes
-- 8e04df6fcbd062e5eaf179a6ec9b0a26f8aa8a39 by Abseil Team <absl-team@google.com>: Use a floating point type for the example usage of absl::uniform_real_distribution. PiperOrigin-RevId: 271167776 -- 5f8f1dfea50bc16a9d9af3e50c4636500a938b29 by Abseil Team <absl-team@google.com>: the llvm wasm backend does not support this data symbol in text section, so remove it from the test. PiperOrigin-RevId: 271138100 -- 2874542cb212962ac3093fd78fd5e1eb85c126c0 by Xiaoyi Zhang <zhangxy@google.com>: Work around MSVC 2019 compiler bug related to constexpr in optional_test. The change in optional_test is necessary to avoid another bug on MSVC complaining about accessing invalid member of union, and also makes the test more reasonale by checking the value of a non-static member. Filed a bug against MSVC https://developercommunity.visualstudio.com/content/problem/743998/internal-compiler-error-related-to-constexpr-and-u.html. PiperOrigin-RevId: 271129805 -- 3a5d56f0c3362aabf68938fb95c4e2d3eca59538 by Abseil Team <absl-team@google.com>: Improve precision of absl::GetCurrentTimeNanos() by adjusting cycle time sooner. PiperOrigin-RevId: 271007945 -- 1e044a6dec7c0ca150fff1aee52dbdb16aa43ed7 by Abseil Team <absl-team@google.com>: Internal change. PiperOrigin-RevId: 270962690 GitOrigin-RevId: 8e04df6fcbd062e5eaf179a6ec9b0a26f8aa8a39 Change-Id: Icb05423a7e93ebdae16baadd59a60b75b5cfa249
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/internal/optional.h4
-rw-r--r--absl/types/optional_test.cc6
2 files changed, 5 insertions, 5 deletions
diff --git a/absl/types/internal/optional.h b/absl/types/internal/optional.h
index 8acbda20..d41ccc75 100644
--- a/absl/types/internal/optional.h
+++ b/absl/types/internal/optional.h
@@ -84,8 +84,8 @@ class optional_data_dtor_base {
bool engaged_;
// Data storage
union {
- dummy_type dummy_;
T data_;
+ dummy_type dummy_;
};
void destruct() noexcept {
@@ -119,8 +119,8 @@ class optional_data_dtor_base<T, true> {
bool engaged_;
// Data storage
union {
- dummy_type dummy_;
T data_;
+ dummy_type dummy_;
};
void destruct() noexcept { engaged_ = false; }
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index e005affb..35efa863 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -944,7 +944,7 @@ TEST(optionalTest, Swap) {
template <int v>
struct DeletedOpAddr {
- constexpr static const int value = v;
+ int value = v;
constexpr DeletedOpAddr() = default;
constexpr const DeletedOpAddr<v>* operator&() const = delete; // NOLINT
DeletedOpAddr<v>* operator&() = delete; // NOLINT
@@ -954,9 +954,9 @@ struct DeletedOpAddr {
// to document the fact that the current implementation of absl::optional<T>
// expects such usecases to be malformed and not compile.
TEST(optionalTest, OperatorAddr) {
- constexpr const int v = -1;
+ constexpr int v = -1;
{ // constexpr
- constexpr const absl::optional<DeletedOpAddr<v>> opt(absl::in_place_t{});
+ constexpr absl::optional<DeletedOpAddr<v>> opt(absl::in_place_t{});
static_assert(opt.has_value(), "");
// static_assert(opt->value == v, "");
static_assert((*opt).value == v, "");