Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Carter <Casey@Carter.net>2017-04-17 22:26:38 +0300
committerNeil MacIntosh <neilmac@microsoft.com>2017-04-17 22:26:38 +0300
commitc5851a8161938798c5594a66420cb814fea92711 (patch)
treeef1138df3d882d425d78fa41d185e3c431497afb /tests/at_tests.cpp
parentc2f953f2eb7ab501325a7ec5656b400d54b8a345 (diff)
Turn warnings into errors (#488)
Diffstat (limited to 'tests/at_tests.cpp')
-rw-r--r--tests/at_tests.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/at_tests.cpp b/tests/at_tests.cpp
index 79f8ddd..db89c34 100644
--- a/tests/at_tests.cpp
+++ b/tests/at_tests.cpp
@@ -45,8 +45,8 @@ SUITE(at_tests)
const std::array<int, 4>& c_a = a;
for (int i = 0; i < 4; ++i) {
- CHECK(&gsl::at(a, i) == &a[i]);
- CHECK(&gsl::at(c_a, i) == &a[i]);
+ CHECK(&gsl::at(a, i) == &a[static_cast<std::size_t>(i)]);
+ CHECK(&gsl::at(c_a, i) == &a[static_cast<std::size_t>(i)]);
}
CHECK_THROW(gsl::at(a, -1), fail_fast);
@@ -61,8 +61,8 @@ SUITE(at_tests)
const std::vector<int>& c_a = a;
for (int i = 0; i < 4; ++i) {
- CHECK(&gsl::at(a, i) == &a[i]);
- CHECK(&gsl::at(c_a, i) == &a[i]);
+ CHECK(&gsl::at(a, i) == &a[static_cast<std::size_t>(i)]);
+ CHECK(&gsl::at(c_a, i) == &a[static_cast<std::size_t>(i)]);
}
CHECK_THROW(gsl::at(a, -1), fail_fast);
@@ -87,7 +87,7 @@ SUITE(at_tests)
}
}
-#if !defined(_MSC_VER) || (defined(__clang__) || _MSC_VER >= 1910)
+#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER >= 1910
static constexpr bool test_constexpr()
{
int a1[4] = { 1, 2, 3, 4 };
@@ -98,7 +98,9 @@ static constexpr bool test_constexpr()
for (int i = 0; i < 4; ++i) {
if (&gsl::at(a1, i) != &a1[i]) return false;
if (&gsl::at(c_a1, i) != &a1[i]) return false;
- if (&gsl::at(c_a2, i) != &c_a2[i]) return false;
+ // requires C++17:
+ // if (&gsl::at(a2, i) != &a2[static_cast<std::size_t>(i)]) return false;
+ if (&gsl::at(c_a2, i) != &c_a2[static_cast<std::size_t>(i)]) return false;
if (gsl::at({1,2,3,4}, i) != i+1) return false;
}