BillyONeal created this revision. In T_size_size.pass, there is an explicit template argument to std::min to ask for unsigned, to avoid type deduction errors. However, C1XX' warnings still hate this use, because a 64 bit value (a size_t) is being passed to a function accepting an unsigned (a 32 bit value).
Instead of supplying explicit template arguments, make all the things involved be unsigned, so there are no type mismatches (and thus, no warning). https://reviews.llvm.org/D32574 Files: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Index: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp =================================================================== --- test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -36,7 +36,7 @@ S s2(sv, pos, n); LIBCPP_ASSERT(s2.__invariants()); 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); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -68,7 +68,7 @@ S s2(sv, pos, n, a); LIBCPP_ASSERT(s2.__invariants()); 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); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == a);
Index: test/std/strings/basic.string/string.cons/T_size_size.pass.cpp =================================================================== --- test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -36,7 +36,7 @@ S s2(sv, pos, n); LIBCPP_ASSERT(s2.__invariants()); 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); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -68,7 +68,7 @@ S s2(sv, pos, n, a); LIBCPP_ASSERT(s2.__invariants()); 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); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == a);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits