`<streambuf>`: fix seekpos and seekoff (#2121)

This commit is contained in:
Igor Zhukov 2021-08-27 07:30:44 +07:00 коммит произвёл GitHub
Родитель 0f8ec3a306
Коммит 3ce4c8fcb9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -357,12 +357,12 @@ protected:
virtual pos_type __CLR_OR_THIS_CALL seekoff( virtual pos_type __CLR_OR_THIS_CALL seekoff(
off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out) { off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out) {
// change position by offset, according to way and mode // change position by offset, according to way and mode
return streampos(-1); return pos_type(off_type(-1));
} }
virtual pos_type __CLR_OR_THIS_CALL seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out) { virtual pos_type __CLR_OR_THIS_CALL seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out) {
// change to specified position, according to mode // change to specified position, according to mode
return streampos(-1); return pos_type(off_type(-1));
} }
virtual basic_streambuf* __CLR_OR_THIS_CALL setbuf(_Elem*, streamsize) { virtual basic_streambuf* __CLR_OR_THIS_CALL setbuf(_Elem*, streamsize) {

Просмотреть файл

@ -179,6 +179,7 @@ tests\GH_001850_clog_tied_to_cout
tests\GH_001914_cached_position tests\GH_001914_cached_position
tests\GH_002039_byte_is_not_trivially_swappable tests\GH_002039_byte_is_not_trivially_swappable
tests\GH_002058_debug_iterator_race tests\GH_002058_debug_iterator_race
tests\GH_002120_streambuf_seekpos_and_seekoff
tests\LWG2597_complex_branch_cut tests\LWG2597_complex_branch_cut
tests\LWG3018_shared_ptr_function tests\LWG3018_shared_ptr_function
tests\P0019R8_atomic_ref tests\P0019R8_atomic_ref

Просмотреть файл

@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
RUNALL_INCLUDE ..\usual_matrix.lst

Просмотреть файл

@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <streambuf>
#include <string>
using namespace std;
struct State {};
struct CharTraits : char_traits<char> {
using state_type = State;
using pos_type = fpos<State>;
};
struct Streambuf : basic_streambuf<char, CharTraits> {};
int main() {} // COMPILE-ONLY