[PATCH] D34534: [libcxx] [test] Fix MSVC warning C4242 "conversion from 'int' to 'const char', possible loss of data".
Stephan T. Lavavej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 22 14:30:27 PDT 2017
STL_MSFT created this revision.
[libcxx] [test] Fix MSVC warning C4242 "conversion from 'int' to 'const char', possible loss of data".
https://reviews.llvm.org/D34534
Files:
test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
Index: test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
===================================================================
--- test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
+++ test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
@@ -46,7 +46,7 @@
if (__c != base::traits_type::eof())
{
int n = str_.size();
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
Index: test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
===================================================================
--- test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
+++ test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -40,7 +40,7 @@
if (__c != base::traits_type::eof())
{
int n = str_.size();
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34534.103639.patch
Type: text/x-patch
Size: 1493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170622/fa62fb0e/attachment.bin>
More information about the cfe-commits
mailing list