libstdc++/7220: g++ 3.1: basic_istream::ignore(0,delimiter) issue.

johnb@stl.sarov.ru johnb@stl.sarov.ru
Sat Jul 6 07:15:00 GMT 2002


>Number:         7220
>Category:       libstdc++
>Synopsis:       g++ 3.1: basic_istream::ignore(0,delimiter) issue.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 06 07:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     johnb@stl.sarov.ru
>Release:        g++ 3.1
>Organization:
>Environment:
Red Hat Linux release 7.2, g++ v3.1
>Description:
basic_istream::ignore(0,delimiter) extracts delimiter if it (delimiter) is at stream read position without regard to first parameter == 0. In case delimiter isn`t at read position ignore(0,delimiter) do nothing and this is correct.
C++ ISO|IEC 27.6.1.3-24 declare that ignore(n,...) should extract n symbols in case n  != numeric_limits<int>::max(). This condition is true for n = 0;
See testcase attached.
>How-To-Repeat:
Compile testcase with g++ 3.1 and run it. You`ll see some "failed" messages.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="ignore.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ignore.cpp"

I2luY2x1ZGUgPHNzdHJlYW0+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCiNkZWZpbmUgSXMJc3RkOjpi
YXNpY19pc3RyZWFtPGNoYXIsc3RkOjpjaGFyX3RyYWl0czxjaGFyPiA+CiNkZWZpbmUgSXQJc3Rk
OjpjaGFyX3RyYWl0czxjaGFyPgojZGVmaW5lIEFsCXN0ZDo6YWxsb2NhdG9yPGNoYXI+CgppbnQg
bWFpbihpbnQsIGNoYXIgKltdKQp7CglpbnQgcmVzID0gMDsKICAgICAgICBzdGQ6OnN0cmVhbXNp
emUgbjsKCXN0ZDo6YmFzaWNfc3RyaW5nPGNoYXIsSXQsQWwgPiBpbnB1dCgoY29uc3QgY2hhciAq
K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