------- Comment #38 from potswa at mac dot com 2010-09-17 17:51 -------
Created an attachment (id=21822)
Works with codecvt. Tested Tested x86_64-darwin, mainline
Ah, now I see the trick:
if (__off == 0 && !(_M_mode & ios_base::out))
So if the file is open for writing, disable the optimization.
I had a problem with this condition for these testcases:
which contain code such as
strmsz_2 = fb_01.sputn(", i wanna reach out and", 10);
fb_01.pubseekoff(0, std::ios_base::cur); // if this doesn't flush
c1 = fb_01.sgetc(); // this underflow is ignored
c2 = fb_01.sputbackc('z'); // as well as this putback
Essentially, pubseekoff(0,cur) is being used as a sync(). I see nothing in the
Standard to support that, and indeed the sync() shouldn't be needed either, so
I was planning to open a new bug.
Anyway, if I apply your limitation to my patch, it passes the unmodified
testsuite, so here it is.