fpos.h (fpos::operator-): Don't return reference, return original, non-modified version.

2001-06-12  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/fpos.h (fpos::operator-): Don't return reference,
	return original, non-modified version.
	(fpos::operator+): Same.
	* testsuite/27_io/fpos.cc: Add test.

[[Split portion of a mixed commit.]]

From-SVN: r43290.2
This commit is contained in:
Benjamin Kosnik 2001-06-13 01:50:27 +00:00 committed by Benjamin Kosnik
parent 7f3e3e0a22
commit 9aaa9ee026
2 changed files with 8 additions and 1 deletions

View File

@ -3,7 +3,8 @@
* include/bits/fpos.h (fpos::operator-): Don't return reference,
return original, non-modified version.
(fpos::operator+): Same.
* testsuite/27_io/fpos.cc: Add test.
2001-06-12 Loren J. Rittle <ljrittle@acm.org>
libstdc++/2071

View File

@ -107,12 +107,18 @@ void test02()
pos03 = pos03 + off02;
pos04 += off02;
VERIFY( pos03 == pos04 );
std::streampos pos05 = pos03;
std::streampos pos06 = pos03 + off02;
VERIFY ( pos05 == pos03 );
// q = p - o
// p -= o
pos03 = pos03 - off02;
pos04 -= off02;
VERIFY( pos03 == pos04 );
std::streampos pos07 = pos03;
std::streampos pos08 = pos03 - off02;
VERIFY ( pos07 == pos03 );
// o = p - q
VERIFY( 0 == pos03 - pos04 );