Commit 04d8afe7 by Abseil Team Committed by Copybara-Service

Remove code pieces for no longer supported MSVC versions.

The current support policy is `_MSC_VER >= 1920`.

PiperOrigin-RevId: 599833619
Change-Id: I9cf7393a5b659d1680765e37e0328539ccb870fa
parent b03cda5e
......@@ -26,12 +26,6 @@
#include "absl/hash/hash_testing.h"
#include "absl/meta/type_traits.h"
#if defined(_MSC_VER) && _MSC_VER == 1900
// Disable "unary minus operator applied to unsigned type" warnings in Microsoft
// Visual C++ 14 (2015).
#pragma warning(disable:4146)
#endif
#define MAKE_INT128(HI, LO) absl::MakeInt128(static_cast<int64_t>(HI), LO)
namespace {
......
......@@ -670,7 +670,7 @@ class string_view {
}
static constexpr size_type StrlenInternal(absl::Nonnull<const char*> str) {
#if defined(_MSC_VER) && _MSC_VER >= 1910 && !defined(__clang__)
#if defined(_MSC_VER) && !defined(__clang__)
// MSVC 2017+ can evaluate this at compile-time.
const char* begin = str;
while (*str != '\0') ++str;
......
......@@ -1051,9 +1051,6 @@ TEST(StringViewTest, ConstexprNullSafeStringView) {
EXPECT_EQ(0u, s.size());
EXPECT_EQ(absl::string_view(), s);
}
#if !defined(_MSC_VER) || _MSC_VER >= 1910
// MSVC 2017+ is required for good constexpr string_view support.
// See the implementation of `absl::string_view::StrlenInternal()`.
{
static constexpr char kHi[] = "hi";
absl::string_view s = absl::NullSafeStringView(kHi);
......@@ -1066,7 +1063,6 @@ TEST(StringViewTest, ConstexprNullSafeStringView) {
EXPECT_EQ(s.size(), 5u);
EXPECT_EQ("hello", s);
}
#endif
}
TEST(StringViewTest, ConstexprCompiles) {
......
......@@ -123,10 +123,9 @@ class OnDestruction {
};
// These tests require that the compiler correctly supports C++11 constant
// initialization... but MSVC has a known regression since v19.10 till v19.25:
// initialization... but MSVC has a known regression (since v19.10) till v19.25:
// https://developercommunity.visualstudio.com/content/problem/336946/class-with-constexpr-constructor-not-using-static.html
#if defined(__clang__) || \
!(defined(_MSC_VER) && _MSC_VER > 1900 && _MSC_VER < 1925)
#if defined(__clang__) || !(defined(_MSC_VER) && _MSC_VER < 1925)
// kConstInit
// Test early usage. (Declaration comes first; definitions must appear after
// the test runner.)
......
......@@ -994,25 +994,6 @@ TEST(optionalTest, PointerStuff) {
#endif
#endif
// MSVC has a bug with "cv-qualifiers in class construction", fixed in 2017. See
// https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#bug-fixes
// The compiler some incorrectly ignores the cv-qualifier when generating a
// class object via a constructor call. For example:
//
// class optional {
// constexpr T&& value() &&;
// constexpr const T&& value() const &&;
// }
//
// using COI = const absl::optional<int>;
// static_assert(2 == COI(2).value(), ""); // const &&
//
// This should invoke the "const &&" overload but since it ignores the const
// qualifier it finds the "&&" overload the best candidate.
#if defined(_MSC_VER) && _MSC_VER < 1910
#define ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
#endif
TEST(optionalTest, Value) {
using O = absl::optional<std::string>;
using CO = const absl::optional<std::string>;
......@@ -1032,8 +1013,7 @@ TEST(optionalTest, Value) {
EXPECT_EQ("c&", TypeQuals(clvalue.value()));
EXPECT_EQ("c&", TypeQuals(lvalue_c.value()));
EXPECT_EQ("&&", TypeQuals(O(absl::in_place, "xvalue").value()));
#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
!defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("c&&", TypeQuals(CO(absl::in_place, "cxvalue").value()));
#endif
EXPECT_EQ("c&&", TypeQuals(OC(absl::in_place, "xvalue_c").value()));
......@@ -1083,8 +1063,7 @@ TEST(optionalTest, DerefOperator) {
EXPECT_EQ("&", TypeQuals(*lvalue));
EXPECT_EQ("c&", TypeQuals(*clvalue));
EXPECT_EQ("&&", TypeQuals(*O(absl::in_place, "xvalue")));
#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
!defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("c&&", TypeQuals(*CO(absl::in_place, "cxvalue")));
#endif
EXPECT_EQ("c&&", TypeQuals(*OC(absl::in_place, "xvalue_c")));
......@@ -1117,11 +1096,9 @@ TEST(optionalTest, ValueOr) {
constexpr absl::optional<double> copt_empty, copt_set = {1.2};
static_assert(42.0 == copt_empty.value_or(42), "");
static_assert(1.2 == copt_set.value_or(42), "");
#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
using COD = const absl::optional<double>;
static_assert(42.0 == COD().value_or(42), "");
static_assert(1.2 == COD(1.2).value_or(42), "");
#endif
}
// make_optional cannot be constexpr until C++17
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment