aboutsummaryrefslogtreecommitdiff
path: root/tests/span_tests.cpp
diff options
context:
space:
mode:
authorDaniel599 <Daniel599@users.noreply.github.com>2018-07-14 03:19:09 +0300
committerAnna Gringauze <annagrin@microsoft.com>2018-07-13 17:19:09 -0700
commit5778149583e69b34ab375039ffcc5d51a4dd7b37 (patch)
tree9c626197b2b9888f358e448909a12a1f9040e823 /tests/span_tests.cpp
parent0cebbd77bfc21acbf1cc05983ad626539eeeb8e0 (diff)
downloadMicrosoft-GSL-5778149583e69b34ab375039ffcc5d51a4dd7b37.tar.gz
Test broken size (#704)
* added test for size check (#590) * added #if for gcc 6.4 bug (#590) * hopefully fix #if for gcc 6.4 bug (#590) * fixed CHECK usage (#590) * gcc broken size bug is only when using optimizations
Diffstat (limited to 'tests/span_tests.cpp')
-rw-r--r--tests/span_tests.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp
index 20279ec..67c1b59 100644
--- a/tests/span_tests.cpp
+++ b/tests/span_tests.cpp
@@ -459,6 +459,23 @@ TEST_CASE("from_std_array_constructor")
auto s = make_span(arr);
CHECK((s.size() == narrow_cast<ptrdiff_t>(arr.size()) && s.data() == arr.data()));
}
+
+ // This test checks for the bug found in gcc 6.1, 6.2, 6.3, 7.1, 7.2, 7.3 - issue #590
+ {
+ span<int> s1 = make_span(arr);
+
+ static span<int> s2;
+ s2 = s1;
+
+ #if __GNUC__ == 6 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ == 0 && defined(__OPTIMIZE__)
+ // Known to be broken in gcc 6.4 with optimizations
+ // Issue in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83116
+ CHECK(s1.size() == 4);
+ CHECK(s2.size() == 0);
+ #else
+ CHECK(s1.size() == s2.size());
+ #endif
+ }
}
TEST_CASE("from_const_std_array_constructor")