diff --git a/stl/inc/streambuf b/stl/inc/streambuf index 081b1ff9820..2cbe9506e80 100644 --- a/stl/inc/streambuf +++ b/stl/inc/streambuf @@ -357,12 +357,12 @@ protected: virtual pos_type __CLR_OR_THIS_CALL seekoff( off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out) { // 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) { // 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) { diff --git a/tests/std/test.lst b/tests/std/test.lst index 0aa6125ab29..72eaebe9158 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -179,6 +179,7 @@ tests\GH_001850_clog_tied_to_cout tests\GH_001914_cached_position tests\GH_002039_byte_is_not_trivially_swappable tests\GH_002058_debug_iterator_race +tests\GH_002120_streambuf_seekpos_and_seekoff tests\LWG2597_complex_branch_cut tests\LWG3018_shared_ptr_function tests\P0019R8_atomic_ref diff --git a/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/env.lst b/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/env.lst new file mode 100644 index 00000000000..19f025bd0e6 --- /dev/null +++ b/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/env.lst @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/test.compile.pass.cpp b/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/test.compile.pass.cpp new file mode 100644 index 00000000000..085c405fffa --- /dev/null +++ b/tests/std/tests/GH_002120_streambuf_seekpos_and_seekoff/test.compile.pass.cpp @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include + +using namespace std; + +struct State {}; + +struct CharTraits : char_traits { + using state_type = State; + using pos_type = fpos; +}; + +struct Streambuf : basic_streambuf {}; + +int main() {} // COMPILE-ONLY