From fdb0b271e860a8bbace2ff037ced0a1a6d17a000 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 8 Dec 2016 13:25:09 +0000 Subject: [PATCH] Fix filesystem test that fails in debug mode * testsuite/experimental/filesystem/path/construct/range.cc: Don't use basic_string::front() when string might be empty. From-SVN: r243438 --- libstdc++-v3/ChangeLog | 3 +++ .../experimental/filesystem/path/construct/range.cc | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 084f0d78a7d..5d8ee466ff5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2016-12-08 Jonathan Wakely + * testsuite/experimental/filesystem/path/construct/range.cc: Don't + use basic_string::front() when string might be empty. + * include/debug/array (swap): Add deleted overload. * include/bits/stl_pair.h (swap): Remove redundant inline keyword from deleted overload. diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc index 3dfec2fac5c..9e51e0a5bf5 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/range.cc @@ -59,13 +59,14 @@ test01() using __gnu_test::test_container; using __gnu_test::input_iterator_wrapper; // Test with input iterators and const value_types + test_container - r1(&s.front(), &s.front() + s.size()); + r1((char*)s.c_str(), (char*)s.c_str() + s.size()); path p9(r1.begin(), r1.end()); compare_paths(p1, p9); test_container - r2(&s.front(), &s.front() + s.size() + 1); // includes null-terminator + r2((char*)s.c_str(), (char*)s.c_str() + s.size() + 1); // includes null-terminator path p10(r2.begin()); compare_paths(p1, p10); @@ -82,12 +83,12 @@ test01() #if _GLIBCXX_USE_WCHAR_T // Test with input iterators and const value_types test_container - r5(&ws.front(), &ws.front() + ws.size()); + r5((wchar_t*)ws.c_str(), (wchar_t*)ws.c_str() + ws.size()); path p13(r5.begin(), r5.end()); compare_paths(p1, p13); test_container - r6(&ws.front(), &ws.front() + ws.size() + 1); // includes null-terminator + r6((wchar_t*)ws.c_str(), (wchar_t*)ws.c_str() + ws.size() + 1); // includes null-terminator path p14(r6.begin()); compare_paths(p1, p14); -- 2.30.2