forked from OSchip/llvm-project
[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. llvm-svn: 289108
This commit is contained in:
parent
7abade3769
commit
84ade982a2
|
@ -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), "");
|
||||
|
|
|
@ -48,7 +48,7 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char> T1;
|
||||
typedef std::tuple<long> T1;
|
||||
typedef std::tuple<double> T2;
|
||||
const T1 t1(1);
|
||||
const T2 t2(1);
|
||||
|
@ -58,7 +58,7 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char> T1;
|
||||
typedef std::tuple<long> T1;
|
||||
typedef std::tuple<double> T2;
|
||||
const T1 t1(1);
|
||||
const T2 t2(0.9);
|
||||
|
@ -68,7 +68,7 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char> T1;
|
||||
typedef std::tuple<long> T1;
|
||||
typedef std::tuple<double> T2;
|
||||
const T1 t1(1);
|
||||
const T2 t2(1.1);
|
||||
|
@ -78,8 +78,8 @@ int main()
|
|||
assert(!(t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<long, int> T1;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1, 2);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -88,8 +88,8 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<long, int> T1;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(0.9, 2);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -98,8 +98,8 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<long, int> T1;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1.1, 2);
|
||||
assert( (t1 < t2));
|
||||
|
@ -108,8 +108,8 @@ int main()
|
|||
assert(!(t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<long, int> T1;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1, 1);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -118,8 +118,8 @@ int main()
|
|||
assert( (t1 >= t2));
|
||||
}
|
||||
{
|
||||
typedef std::tuple<char, int> T1;
|
||||
typedef std::tuple<double, char> T2;
|
||||
typedef std::tuple<long, int> T1;
|
||||
typedef std::tuple<double, long> T2;
|
||||
const T1 t1(1, 2);
|
||||
const T2 t2(1, 3);
|
||||
assert( (t1 < t2));
|
||||
|
@ -128,8 +128,8 @@ int main()
|
|||
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));
|
||||
|
@ -138,8 +138,8 @@ int main()
|
|||
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(0.9, 2, 3);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -148,8 +148,8 @@ int main()
|
|||
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));
|
||||
|
@ -158,8 +158,8 @@ int main()
|
|||
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);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -168,8 +168,8 @@ int main()
|
|||
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));
|
||||
|
@ -178,8 +178,8 @@ int main()
|
|||
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, 2);
|
||||
assert(!(t1 < t2));
|
||||
|
@ -188,8 +188,8 @@ int main()
|
|||
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));
|
||||
|
@ -199,8 +199,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, 2, 4);
|
||||
static_assert( (t1 < t2), "");
|
||||
|
|
Loading…
Reference in New Issue