Skip to content

Commit ca27c49

Browse files
committed
Fixed std::basic_stringbuf
1 parent 85a4014 commit ca27c49

File tree

6 files changed

+1
-15
lines changed

6 files changed

+1
-15
lines changed

libcxx/include/sstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public:
416416
template <class _Tp>
417417
requires is_convertible_v<const _Tp&, basic_string_view<_CharT, _Traits>>
418418
_LIBCPP_HIDE_FROM_ABI basic_stringbuf(const _Tp& __t, ios_base::openmode __which, const _Allocator& __a)
419-
: __hm_(nullptr), __mode_(__which | ios_base::in | ios_base::out) {
419+
: __hm_(nullptr), __mode_(__which) {
420420
basic_string_view<_CharT, _Traits> __sv = __t;
421421
__str_ = string_type(__sv, __a);
422422
__init_buf_ptrs();

libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.move.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct StringBuf : std::stringbuf {
5555
};
5656

5757
static void test_altered_sequence_pointers() {
58-
#if TEST_STD_VER < 26
5958
{
6059
auto src = StringBuf("hello world", std::ios_base::in);
6160
src.public_setg(4, 6, 9);
@@ -80,7 +79,6 @@ static void test_altered_sequence_pointers() {
8079
assert(dest.str().empty());
8180
assert(dest.view().empty());
8281
}
83-
#endif // TEST_STD_VER < 26
8482
}
8583

8684
int main(int, char**) {

libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ struct StringBuf : std::stringbuf {
2828
};
2929

3030
static void test_altered_sequence_pointers() {
31-
#if TEST_STD_VER < 26
3231
{
3332
StringBuf src("hello world", std::ios_base::in);
3433
src.public_setg(4, 6, 9);
@@ -49,7 +48,6 @@ static void test_altered_sequence_pointers() {
4948
LIBCPP_ASSERT(str == "o wor");
5049
LIBCPP_ASSERT(dest.str() == "o wor");
5150
}
52-
#endif // TEST_STD_VER < 26
5351
}
5452

5553
int main(int, char**)

libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/view.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct StringBuf : std::stringbuf {
5959
};
6060

6161
static void test_altered_sequence_pointers() {
62-
#if TEST_STD_VER < 26
6362
{
6463
auto src = StringBuf("hello world", std::ios_base::in);
6564
src.public_setg(4, 6, 9);
@@ -76,7 +75,6 @@ static void test_altered_sequence_pointers() {
7675
assert(dest.view() == dest.str());
7776
LIBCPP_ASSERT(dest.view() == "o wor");
7877
}
79-
#endif // TEST_STD_VER < 26
8078
}
8179

8280
int main(int, char**) {

libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int main(int, char**)
4545
assert(sb.pubseekoff(0, std::ios_base::cur, std::ios_base::out) == 0);
4646
assert(sb.pubseekoff(0, std::ios_base::end, std::ios_base::out) == 0);
4747
}
48-
#if TEST_STD_VER < 26
4948
{
5049
std::stringbuf sb("0123456789", std::ios_base::in);
5150
assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
@@ -79,7 +78,6 @@ int main(int, char**)
7978
assert(sb.sputc('c') == 'c');
8079
assert(sb.str() == "012a456c89");
8180
}
82-
#endif // TEST_STD_VER < 26
8381
{
8482
std::stringbuf sb("0123456789");
8583
assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);
@@ -108,7 +106,6 @@ int main(int, char**)
108106
assert(sb.str() == "0123456c89");
109107
}
110108
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
111-
# if TEST_STD_VER < 26
112109
{
113110
std::wstringbuf sb(L"0123456789", std::ios_base::in);
114111
assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
@@ -142,7 +139,6 @@ int main(int, char**)
142139
assert(sb.sputc(L'c') == L'c');
143140
assert(sb.str() == L"012a456c89");
144141
}
145-
# endif // TEST_STD_VER < 26
146142
{
147143
std::wstringbuf sb(L"0123456789");
148144
assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == 3);

libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekpos.pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
int main(int, char**)
2323
{
24-
#if TEST_STD_VER < 26
2524
{
2625
std::stringbuf sb("0123456789", std::ios_base::in);
2726
assert(sb.pubseekpos(3, std::ios_base::out) == -1);
@@ -37,7 +36,6 @@ int main(int, char**)
3736
assert(sb.sputc('a') == 'a');
3837
assert(sb.str() == "012a456789");
3938
}
40-
#endif // TEST_STD_VER < 26
4139
{
4240
std::stringbuf sb("0123456789");
4341
assert(sb.pubseekpos(3, std::ios_base::in) == 3);
@@ -51,7 +49,6 @@ int main(int, char**)
5149
assert(sb.str() == "0123456789");
5250
}
5351
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
54-
# if TEST_STD_VER < 26
5552
{
5653
std::wstringbuf sb(L"0123456789", std::ios_base::in);
5754
assert(sb.pubseekpos(3, std::ios_base::out) == -1);
@@ -67,7 +64,6 @@ int main(int, char**)
6764
assert(sb.sputc(L'a') == L'a');
6865
assert(sb.str() == L"012a456789");
6966
}
70-
# endif // TEST_STD_VER < 26
7167
{
7268
std::wstringbuf sb(L"0123456789");
7369
assert(sb.pubseekpos(3, std::ios_base::in) == 3);

0 commit comments

Comments
 (0)