[libcxx] r289108 - [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 4/7.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 8 13:38:23 PST 2016
Author: stl_msft
Date: Thu Dec 8 15:38:23 2016
New Revision: 289108
URL: http://llvm.org/viewvc/llvm-project?rev=289108&view=rev
Log:
[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.
Modified:
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp?rev=289108&r1=289107&r2=289108&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp Thu Dec 8 15:38:23 2016
@@ -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), "");
Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp?rev=289108&r1=289107&r2=289108&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp Thu Dec 8 15:38:23 2016
@@ -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), "");
More information about the cfe-commits
mailing list