[libcxx] [test] D27019: Fix MSVC warning C4245 "conversion from 'X' to 'Y', signed/unsigned mismatch", part 6/12.
Add static_cast when initializing unsigned integers with negative numbers (in order to obtain big values). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -76,7 +76,7 @@ int main()
|
|||||||
testbuf<char> sb;
|
testbuf<char> sb;
|
||||||
std::ostream os(&sb);
|
std::ostream os(&sb);
|
||||||
hex(os);
|
hex(os);
|
||||||
unsigned long long n = -10;
|
unsigned long long n = static_cast<unsigned long long>(-10);
|
||||||
os << n;
|
os << n;
|
||||||
assert(sb.str() == "fffffffffffffff6");
|
assert(sb.str() == "fffffffffffffff6");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ int main()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long v = -1;
|
unsigned long v = static_cast<unsigned long>(-1);
|
||||||
char str[50];
|
char str[50];
|
||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
@@ -69,7 +69,7 @@ int main()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long v = -1000;
|
unsigned long v = static_cast<unsigned long>(-1000);
|
||||||
char str[50];
|
char str[50];
|
||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
@@ -307,7 +307,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long v = -1000;
|
unsigned long v = static_cast<unsigned long>(-1000);
|
||||||
right(ios);
|
right(ios);
|
||||||
showpos(ios);
|
showpos(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
@@ -321,7 +321,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long v = -1000;
|
unsigned long v = static_cast<unsigned long>(-1000);
|
||||||
left(ios);
|
left(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
char str[50];
|
char str[50];
|
||||||
@@ -334,7 +334,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long v = -1000;
|
unsigned long v = static_cast<unsigned long>(-1000);
|
||||||
internal(ios);
|
internal(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
char str[50];
|
char str[50];
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ int main()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long long v = -1;
|
unsigned long long v = static_cast<unsigned long long>(-1);
|
||||||
char str[50];
|
char str[50];
|
||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
@@ -69,7 +69,7 @@ int main()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long long v = -1000;
|
unsigned long long v = static_cast<unsigned long long>(-1000);
|
||||||
char str[50];
|
char str[50];
|
||||||
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
|
||||||
std::string ex(str, iter.base());
|
std::string ex(str, iter.base());
|
||||||
@@ -307,7 +307,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long long v = -1000;
|
unsigned long long v = static_cast<unsigned long long>(-1000);
|
||||||
right(ios);
|
right(ios);
|
||||||
showpos(ios);
|
showpos(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
@@ -320,7 +320,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long long v = -1000;
|
unsigned long long v = static_cast<unsigned long long>(-1000);
|
||||||
left(ios);
|
left(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
char str[50];
|
char str[50];
|
||||||
@@ -332,7 +332,7 @@ int main()
|
|||||||
{
|
{
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
|
||||||
unsigned long long v = -1000;
|
unsigned long long v = static_cast<unsigned long long>(-1000);
|
||||||
internal(ios);
|
internal(ios);
|
||||||
ios.width(10);
|
ios.width(10);
|
||||||
char str[50];
|
char str[50];
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int main()
|
|||||||
{
|
{
|
||||||
const my_facet f(1);
|
const my_facet f(1);
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned int v = -1;
|
unsigned int v = static_cast<unsigned int>(-1);
|
||||||
{
|
{
|
||||||
const char str[] = "0";
|
const char str[] = "0";
|
||||||
std::ios_base::iostate err = ios.goodbit;
|
std::ios_base::iostate err = ios.goodbit;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int main()
|
|||||||
{
|
{
|
||||||
const my_facet f(1);
|
const my_facet f(1);
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long v = -1;
|
unsigned long v = static_cast<unsigned long>(-1);
|
||||||
{
|
{
|
||||||
const char str[] = "0";
|
const char str[] = "0";
|
||||||
std::ios_base::iostate err = ios.goodbit;
|
std::ios_base::iostate err = ios.goodbit;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int main()
|
|||||||
{
|
{
|
||||||
const my_facet f(1);
|
const my_facet f(1);
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned long long v = -1;
|
unsigned long long v = static_cast<unsigned long long>(-1);
|
||||||
{
|
{
|
||||||
const char str[] = "0";
|
const char str[] = "0";
|
||||||
std::ios_base::iostate err = ios.goodbit;
|
std::ios_base::iostate err = ios.goodbit;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int main()
|
|||||||
{
|
{
|
||||||
const my_facet f(1);
|
const my_facet f(1);
|
||||||
std::ios ios(0);
|
std::ios ios(0);
|
||||||
unsigned short v = -1;
|
unsigned short v = static_cast<unsigned short>(-1);
|
||||||
{
|
{
|
||||||
const char str[] = "0";
|
const char str[] = "0";
|
||||||
std::ios_base::iostate err = ios.goodbit;
|
std::ios_base::iostate err = ios.goodbit;
|
||||||
|
|||||||
Reference in New Issue
Block a user