summaryrefslogtreecommitdiff
path: root/absl/types
diff options
context:
space:
mode:
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/optional_test.cc9
-rw-r--r--absl/types/span.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index 645f5b93..5eedfcfd 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -270,8 +270,17 @@ TEST(optionalTest, CopyConstructor) {
EXPECT_TRUE(absl::is_trivially_copy_constructible<
absl::optional<const TrivialCopyable>>::value);
#endif
+ // When testing with VS 2017 15.3, there seems to be a bug in MSVC
+ // std::optional when T is volatile-qualified. So skipping this test.
+ // Bug report:
+ // https://connect.microsoft.com/VisualStudio/feedback/details/3142534
+#if defined(ABSL_HAVE_STD_OPTIONAL) && defined(_MSC_VER) && _MSC_VER >= 1911
+#define ABSL_MSVC_OPTIONAL_VOLATILE_COPY_BUG 1
+#endif
+#ifndef ABSL_MSVC_OPTIONAL_VOLATILE_COPY_BUG
EXPECT_FALSE(std::is_copy_constructible<
absl::optional<volatile TrivialCopyable>>::value);
+#endif
}
}
diff --git a/absl/types/span.h b/absl/types/span.h
index e1f006ad..f4738153 100644
--- a/absl/types/span.h
+++ b/absl/types/span.h
@@ -378,7 +378,7 @@ class Span {
//
// Returns a reference to the i'th element of this span.
constexpr reference at(size_type i) const {
- return ABSL_PREDICT_FALSE(i < size())
+ return ABSL_PREDICT_TRUE(i < size())
? ptr_[i]
: (base_internal::ThrowStdOutOfRange(
"Span::at failed bounds check"),