From: Jonathan Wakely Date: Fri, 30 Sep 2022 14:54:19 +0000 (+0100) Subject: libstdc++: Remove dependency from std::bitset::to_ulong() test X-Git-Tag: basepoints/gcc-14~4208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=789ddef1cf5a906802f61b2c494a86b80489f2e5;p=thirdparty%2Fgcc.git libstdc++: Remove dependency from std::bitset::to_ulong() test There's no need to use a stringstream to test the to_ulong() member. This will allow the test to be used in freestanding mode. libstdc++-v3/ChangeLog: * testsuite/20_util/bitset/access/to_ulong.cc: Construct bitset from binary literal instead of using stringstream. --- diff --git a/libstdc++-v3/testsuite/20_util/bitset/access/to_ulong.cc b/libstdc++-v3/testsuite/20_util/bitset/access/to_ulong.cc index 8163701e3429..edc021c209c9 100644 --- a/libstdc++-v3/testsuite/20_util/bitset/access/to_ulong.cc +++ b/libstdc++-v3/testsuite/20_util/bitset/access/to_ulong.cc @@ -20,22 +20,11 @@ // 23.3.5.2 bitset members #include -#include -#include #include void test03() { - std::bitset<5> b; - std::stringstream ss("101"); - ss.exceptions(std::ios_base::eofbit); - - try - { - ss >> b; - } - catch (std::exception&) { } - + std::bitset<5> b(0b101); VERIFY( b.to_ulong() == 5 ); }