[PATCH] D32574: [libcxx] [test] Fixed possible loss of data warnings in tests on amd64
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 4 01:08:38 PDT 2017
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.
LGTM after addressing inline comments.
================
Comment at: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp:39
assert(pos <= sv.size());
- unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
+ unsigned rlen = std::min(static_cast<unsigned>(sv.size()) - pos, n);
assert(s2.size() == rlen);
----------------
The cast should happen after the subtraction, not before.
================
Comment at: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp:71
assert(pos <= sv.size());
- unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
+ unsigned rlen = std::min(static_cast<unsigned>(sv.size()) - pos, n);
assert(s2.size() == rlen);
----------------
The cast should happen after the subtraction, not before.
https://reviews.llvm.org/D32574
More information about the cfe-commits
mailing list