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:
authorAnna Gringauze <annagrin@microsoft.com>2015-11-24 00:24:08 +0300
committerAnna Gringauze <annagrin@microsoft.com>2015-12-02 00:41:23 +0300
commit8c5d06dc791c7dea8148a5d3867473fab2e2fcf3 (patch)
tree0c6189584260fa76b068d49ecda9135eca229229 /tests/string_span_tests.cpp
parente3878a655658d8198fa9ad5ea9df7ad9705bd6db (diff)
fixed GCC and clang compilation issues
Diffstat (limited to 'tests/string_span_tests.cpp')
-rw-r--r--tests/string_span_tests.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/string_span_tests.cpp b/tests/string_span_tests.cpp
index 08faaa8..90b7c3c 100644
--- a/tests/string_span_tests.cpp
+++ b/tests/string_span_tests.cpp
@@ -248,7 +248,7 @@ SUITE(string_span_tests)
cstring_span<> sp2{ ptr, 3 }; // bad... but can't help there
CHECK(sp1[1] == 'b');
- CHECK_THROW((sp1[2] == 'c'), fail_fast);
+ CHECK_THROW((void)(sp1[2] == 'c'), fail_fast);
CHECK(sp2[1] == 'b');
//CHECK_THROW((sp1[2] == 'c'), fail_fast); // buffer overflow
@@ -295,9 +295,12 @@ SUITE(string_span_tests)
// from non-const ptr and length
{
+ // does not compile with GCC (ISO standard does not allow converting string literals to char*)
+#ifdef CONFIRM_COMPILATION_ERRORS
char* ptr = "Hello";
cstring_span<> span{ ptr, 5 };
CHECK(span.length() == 5);
+#endif
}
// from const string
@@ -398,9 +401,12 @@ SUITE(string_span_tests)
// from non-const ptr and length
{
+ // does not compile with GCC (ISO standard does not allows converting string literals to char*)
+#ifdef CONFIRM_COMPILATION_ERRORS
char* ptr = "Hello";
string_span<> span{ ptr, 5 };
CHECK(span.length() == 5);
+#endif
}
// from const string