This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix string_view tests.
ClosedPublic

Authored by STL_MSFT on Dec 9 2016, 2:38 PM.

Details

Summary

[libcxx] [test] Fix string_view tests.

test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
Passing -1 to size_t triggers signed/unsigned mismatch warnings because it's
a value-modifying conversion. Add static_cast<size_t> to soothe the compiler.
(This file refers to size_t unqualified.)

test/std/strings/string.view/string.view.ops/substr.pass.cpp
Add <algorithm> for std::min() and <stdexcept> for std::out_of_range.

N4618 21.4.2.4 [string.view.access]/1: "Requires: pos < size()."
/4: "[ Note: Unlike basic_string::operator[], basic_string_view::operator[](size())
has undefined behavior instead of returning charT(). -end note ]"

Diff Detail

Event Timeline

STL_MSFT updated this revision to Diff 80957.Dec 9 2016, 2:38 PM
STL_MSFT retitled this revision from to [libcxx] [test] Fix string_view tests..
STL_MSFT updated this object.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.
EricWF accepted this revision.Dec 9 2016, 2:39 PM
EricWF edited edge metadata.
This revision is now accepted and ready to land.Dec 9 2016, 2:39 PM
STL_MSFT closed this revision.Dec 9 2016, 2:47 PM