diff options
| author | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:12:34 +0000 |
|---|---|---|
| committer | Stephan T. Lavavej <stl@exchange.microsoft.com> | 2016-12-06 01:12:34 +0000 |
| commit | fbfb2ab63e94f1b0c248cd810ae3fb35889d99b6 (patch) | |
| tree | 67ea304c455aa91bacfbd7b4be06824ff157ce3c /libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp | |
| parent | ad55ee58691b58f3ac36e688fc90808d5cf71e7f (diff) | |
| download | bcm5719-llvm-fbfb2ab63e94f1b0c248cd810ae3fb35889d99b6.tar.gz bcm5719-llvm-fbfb2ab63e94f1b0c248cd810ae3fb35889d99b6.zip | |
[libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", part 8/12.
Add static_cast<std::size_t> when comparing distance() to size().
These replacements were performed programmatically with regex_replace():
const vector<pair<regex, string>> reg_fmt = {
{ regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"),
"assert($1.size() == static_cast<std::size_t>(std::distance($2)))" },
{ regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"),
"assert(static_cast<std::size_t>(distance($1)) == $2.size())" },
{ regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"),
"assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" },
};
Also, include <cstddef> when it wasn't already being included.
llvm-svn: 288745
Diffstat (limited to 'libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp')
| -rw-r--r-- | libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp index 0dff181baca..3de5586ab92 100644 --- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp +++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp @@ -47,7 +47,7 @@ test(C& c1) std::size_t c1_osize = c1.size(); c1.pop_front(); assert(c1.size() == c1_osize - 1); - assert(distance(c1.begin(), c1.end()) == c1.size()); + assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size()); I i = c1.begin(); for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i) assert(*i == j); |

