[PATCH] D27538: [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 1/7.
Stephan T. Lavavej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 7 13:59:07 PST 2016
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 1/7.
Given `std::basic_streambuf<CharT>::int_type __c`, `std::basic_string<CharT> str_`,
and having checked `__c != std::basic_streambuf<CharT>::traits_type::eof()` (substituting typedefs
for clarity), the line `str_.push_back(__c);` is safe according to humans, but truncates according
to compilers. `str_.push_back(static_cast<CharT>(__c));` avoids that problem.
https://reviews.llvm.org/D27538
Files:
test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27538.80652.patch
Type: text/x-patch
Size: 25741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161207/d1afa5b0/attachment-0001.bin>
More information about the cfe-commits
mailing list