[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 4/7.
Change char to long and remove some char casts. This preserves test coverage for tuple's heterogeneous comparisons, while avoiding int-to-char truncation warnings. Fixes D27541. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -51,95 +51,95 @@ int main()
|
||||
}
|
||||
{
|
||||
typedef std::tuple<int, double> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1, char(2));
|
||||
const T2 t2(1, 2);
|
||||
assert(t1 == t2);
|
||||
assert(!(t1 != t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<int, double> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1, char(3));
|
||||
const T2 t2(1, 3);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<int, double> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1.1, char(2));
|
||||
const T2 t2(1.1, 2);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<int, double> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1.1, char(3));
|
||||
const T2 t2(1.1, 3);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1, 2, 3);
|
||||
assert(t1 == t2);
|
||||
assert(!(t1 != t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1.1, 2, 3);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1, 3, 3);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1, 2, 4);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1, 3, 2);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1.1, 2, 2);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1.1, 3, 3);
|
||||
assert(!(t1 == t2));
|
||||
assert(t1 != t2);
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
const T1 t1(1, 2, 3);
|
||||
const T2 t2(1.1, 3, 2);
|
||||
assert(!(t1 == t2));
|
||||
@@ -147,8 +147,8 @@ int main()
|
||||
}
|
||||
#if TEST_STD_VER > 11
|
||||
{
|
||||
typedef std::tuple<char, int, double> T1;
|
||||
typedef std::tuple<double, char, int> T2;
|
||||
typedef std::tuple<long, int, double> T1;
|
||||
typedef std::tuple<double, long, int> T2;
|
||||
constexpr T1 t1(1, 2, 3);
|
||||
constexpr T2 t2(1.1, 3, 2);
|
||||
static_assert(!(t1 == t2), "");
|
||||
|
||||
Reference in New Issue
Block a user