<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - ostream::seekp() not standard-compliant"
href="http://llvm.org/bugs/show_bug.cgi?id=21361">21361</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ostream::seekp() not standard-compliant
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lavr@ncbi.nlm.nih.gov
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Hello,
We're using Cland 3.4.0 with _LIBCPP_VERSION 1101, and ran into a problem
that a stream that has only a eofbit set in its state cannot be positioned
with any of the seekp() methods. Upon a closer view, it turned out
that the LIBCPP's implementation builds a sentry object (which is another
way of checking for good(), basically), but the standard (both old and new)
says that "fail() != true" is the only prerequisite for the calls to work.
In case of only the eofbit set, good() != true, but fail() != true, either.
So the sentry object fails, causing seekp() to fail in LIBCPP; but it should
have worked.
A fix would be much appreciated.
Thanks,
Anton Lavrentiev
Here's the comparison of LIBCPP's and GCC's/MSVC's (both of which work
correctly, BTW) implemetations:
LIBCPP:
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
sentry __s(*this);
if (__s)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) ==
pos_type(-1))
GCC:
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
seekp(off_type __off, ios_base::seekdir __dir)
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
if (!this->fail())
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams?
const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
ios_base::out);
MSVC:
_Myt& __CLR_OR_THIS_CALL seekp(off_type _Off, ios_base::seekdir _Way)
{ // change output stream position by _Off, according to _Way
if (!ios_base::fail()
&& (off_type)_Myios::rdbuf()->pubseekoff(_Off, _Way,
ios_base::out) == _BADOFF)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>