[libcxx] [test] Avoid MSVC truncation warnings.
authorStephan T. Lavavej <stl@exchange.microsoft.com>
Thu, 12 Apr 2018 23:56:07 +0000 (23:56 +0000)
committerStephan T. Lavavej <stl@exchange.microsoft.com>
Thu, 12 Apr 2018 23:56:07 +0000 (23:56 +0000)
commit0f66190aefa0c53648d549738a2bb312a309c2d9
treeba28a5d5102d812710c0dccc6844a90a6b284dd1
parent0c8ee891a75dfdc1c3420e36389d6ea7c680d1fb
[libcxx] [test] Avoid MSVC truncation warnings.

MSVC emits "warning C4244: 'initializing': conversion from 'int'
to 'short', possible loss of data" when it sees pair<Whatever, short>
constructed from (whatever, 4), because int is being truncated to
short within pair's constructor. (The compiler doesn't take into
account the fact that 4 is a literal at the callsite; it generates
this warning when the constructor is instantiated, because it might
be called with a runtime-valued int that would actually truncate.)

Instead of static_cast<short>, we can simply change short to int
in these tests, without affecting the pair operations that they're
trying to test: move assignment, convert copy construction, and
convert move construction.

Fixes D45016.

llvm-svn: 329973
libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
libcxx/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
libcxx/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp