[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#187599: Cannot subtract from streampos



Package: g++
Version: 3.2.3-20030331

If I have the following code:

#include <sstream>

int foo()
{
  std::streampos pos;
  pos - 1;
}

When I compile this with "g++ -Wall test.cc", this gives me:

test.cc: In function `int foo()':
test.cc:6: ISO C++ says that `std::fpos<_StateT>
std::fpos<_StateT>::operator-(long int) [with _StateT = mbstate_t]' and ` operator-' are ambiguous even though the worst conversion for the former is
   better than the worst conversion for the latter

I think this means that there are both a global operator- and a member operator- defined for std::fpos<_StateT>. I can work around this (I can do pos -= 1 and afterwards pos += 1), but I'd much rather be able to simply subtract from the streampos.




Reply to: