diff options
| author | Louis Dionne <ldionne@apple.com> | 2019-08-20 18:21:06 +0000 |
|---|---|---|
| committer | Louis Dionne <ldionne@apple.com> | 2019-08-20 18:21:06 +0000 |
| commit | fc4486c2472b84384d4a31d2436a91bdb9b29792 (patch) | |
| tree | 3968eeafd4f5ce7c2e06a461c2992eddd89a0bb9 /libcxx/test/std/utilities | |
| parent | 292b1087f408b020f6bfdfbc27ffa062e0bef0a8 (diff) | |
| download | bcm5719-llvm-fc4486c2472b84384d4a31d2436a91bdb9b29792.tar.gz bcm5719-llvm-fc4486c2472b84384d4a31d2436a91bdb9b29792.zip | |
[libc++] Implement LWG 3199
Summary:
The resolution of LWG 3199 makes sure that input-streaming into an empty bitset
does not set the failbit on the input stream.
Reviewers: mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D65105
llvm-svn: 369422
Diffstat (limited to 'libcxx/test/std/utilities')
| -rw-r--r-- | libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp index 1cb92ea3458..0127b75160b 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.operators/stream_in.pass.cpp @@ -25,6 +25,18 @@ int main(int, char**) in >> b; assert(b.to_ulong() == 0x5A); } + { + // Make sure that input-streaming an empty bitset does not cause the + // failbit to be set (LWG 3199). + std::istringstream in("01011010"); + std::bitset<0> b; + in >> b; + assert(b.to_string() == ""); + assert(!in.bad()); + assert(!in.fail()); + assert(!in.eof()); + assert(in.good()); + } #ifndef TEST_HAS_NO_EXCEPTIONS { std::stringbuf sb; |

