Bug 14320 - [3.4/4.0 Regression] istreambuf_iterator::difference_type is not a signed integral type
[3.4/4.0 Regression] istreambuf_iterator::difference_type is not a signed int...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: libstdc++
3.4.0
: P2 normal
: 3.4.0
Assigned To: Paolo Carlini
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-02-27 13:40 UTC by Pétur Runólfsson
Modified: 2004-09-13 14:15 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2004-02-27 14:52:36


Attachments
Test case (651 bytes, text/plain)
2004-02-27 13:54 UTC, Pétur Runólfsson
Details
Test case (260 bytes, text/plain)
2004-02-27 13:55 UTC, Pétur Runólfsson
Details
Test case (211 bytes, text/plain)
2004-02-27 13:57 UTC, Pétur Runólfsson
Details
Test case (210 bytes, text/plain)
2004-02-27 13:58 UTC, Pétur Runólfsson
Details
Test case (223 bytes, text/plain)
2004-02-27 14:00 UTC, Pétur Runólfsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pétur Runólfsson 2004-02-27 13:40:48 UTC
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.
Comment 1 Pétur Runólfsson 2004-02-27 13:54:11 UTC
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.
Comment 2 Pétur Runólfsson 2004-02-27 13:55:11 UTC
Created attachment 5807 [details]
Test case

This test case uses numeric_limits to check if
istreambuf_iterator::difference_type is a signed integral type.
Comment 3 Pétur Runólfsson 2004-02-27 13:57:21 UTC
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).
Comment 4 Pétur Runólfsson 2004-02-27 13:58:29 UTC
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).
Comment 5 Pétur Runólfsson 2004-02-27 14:00:20 UTC
Created attachment 5810 [details]
Test case

This test case checks if istreambuf_iterator::difference_type can be
extracted from an istream using operator>>
Comment 6 Paolo Carlini 2004-02-27 14:52:36 UTC
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.
Comment 7 Gabriel Dos Reis 2004-02-27 17:54:49 UTC
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
Comment 8 Mark Mitchell 2004-02-28 03:23:22 UTC
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.
Comment 9 Paolo Carlini 2004-03-01 22:11:04 UTC
Will commit a fix for 3.4.
Comment 10 CVS Commits 2004-03-03 00:22:09 UTC
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

Comment 11 CVS Commits 2004-03-04 09:47:29 UTC
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

Comment 12 Paolo Carlini 2004-03-04 09:49:03 UTC
Fixed.