As described here: http://gcc.gnu.org/ml/libstdc++/2004-02/msg00356.html the standard requires that the difference_type of an iterator must be a signed integral type, but istreambuf_iterator::difference_type currently fails to meet this requirement.
Created attachment 5806 [details] Test case Since C++98 defines at most 6 signed integral types, this test case checks istreambuf_iterator::difference_type against them all to see if it is one of those types.
Created attachment 5807 [details] Test case This test case uses numeric_limits to check if istreambuf_iterator::difference_type is a signed integral type.
Created attachment 5808 [details] Test case This test case checks if istreambuf_iterator::difference_type provides operator*= (this operator is supported by all signed integral types).
Created attachment 5809 [details] Test case This test case checks if istreambuf_iterator::difference_type can be used in standard conversions (in this case conversion to bool).
Created attachment 5810 [details] Test case This test case checks if istreambuf_iterator::difference_type can be extracted from an istream using operator>>
Hi Pétur... Should we change streamoff itself? I think so. Can't we basically revert for streamoff to the 3_3 situation? Since the type is mostly implementation defined, the only tricky point seems the constructor from fpos (which indeed, in the present form represents a "surprise" for many people around ;), but this is only a type safety (i.e., QoI) issue.
Subject: Re: [3.4/3.5 Regression] istreambuf_iterator::difference_type is not a signed integral type "pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes: | Hi Pétur... | | Should we change streamoff itself? I think so. I'm of the opposite opinion. The notion of "integer type" as currently difined should be fixed. -- gaby
Gaby, are you saying that you think the standard is incorrect? If so, would you a please file a DR? If the committee is not going to change this, then we need to fix V3, independently of whether or not we think it is the right thing or not.
Will commit a fix for 3.4.
Subject: Bug 14320 CVSROOT: /cvs/gcc Module name: gcc Changes by: paolo@gcc.gnu.org 2004-03-03 00:22:05 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: postypes.h libstdc++-v3/testsuite/27_io/fpos/mbstate_t: 4_neg.cc Added files: libstdc++-v3/testsuite/27_io/fpos: 14320-1.cc 14320-2.cc 14320-3.cc 14320-4.cc 14320-5.cc Log message: 2004-03-02 Paolo Carlini <pcarlini@suse.de> PR libstdc++/14320 * include/bits/postypes.h (class streamoff): Remove, now streamoff is just typedef a 64 bit signed integer type. (class fpos): Tweak consistently. * testsuite/27_io/fpos/14320-1.cc: New. * testsuite/27_io/fpos/14320-2.cc: New. * testsuite/27_io/fpos/14320-3.cc: New. * testsuite/27_io/fpos/14320-4.cc: New. * testsuite/27_io/fpos/14320-5.cc: New. * testsuite/27_io/fpos/mbstate_t/4_neg.cc: xfail for now. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2372&r2=1.2373 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/postypes.h.diff?cvsroot=gcc&r1=1.6&r2=1.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-2.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-3.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-4.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-5.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc.diff?cvsroot=gcc&r1=1.1&r2=1.2
Subject: Bug 14320 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: paolo@gcc.gnu.org 2004-03-04 09:47:24 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: postypes.h libstdc++-v3/testsuite/27_io/fpos/mbstate_t: 4_neg.cc Added files: libstdc++-v3/testsuite/27_io/fpos: 14320-1.cc 14320-2.cc 14320-3.cc 14320-4.cc 14320-5.cc Log message: 2004-03-04 Paolo Carlini <pcarlini@suse.de> PR libstdc++/14320 * include/bits/postypes.h (class streamoff): Remove, now streamoff is just typedef a 64 bit signed integer type. (class fpos): Tweak consistently. * testsuite/27_io/fpos/14320-1.cc: New. * testsuite/27_io/fpos/14320-2.cc: New. * testsuite/27_io/fpos/14320-3.cc: New. * testsuite/27_io/fpos/14320-4.cc: New. * testsuite/27_io/fpos/14320-5.cc: New. * testsuite/27_io/fpos/mbstate_t/4_neg.cc: xfail for now. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.55&r2=1.2224.2.56 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/postypes.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3.6.2&r2=1.3.6.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-2.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-3.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-4.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/14320-5.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=1.1.14.1
Fixed.