[Bug libstdc++/37957] New: Wrong behaviour of num_get<>::do_get(bool) in the case when one target sequence is a prefix of the other one
tsyvarev at ispras dot ru
gcc-bugzilla@gcc.gnu.org
Thu Oct 30 14:23:00 GMT 2008
There are some examples in the description of member function of the num_get<>
facet
iter_type do_get(iter_type in, iter_type end, ios_base& str, ios_base::iostate&
err, bool& val) const
for the case when (str.flags() & ios_base::boolalpha) != 0, that clarify the
algorithm that the function implements (22.2.2.1.2, p16):
For targets true: "a" and false: "abb", the input sequence "a" yields val ==
true and err == str.eofbit; the input sequence "abc" yields err = str.failbit,
with in ending at the 'c'.
In the last example, however, the attached test program shows the following:
andrew@Ubuntu:/mnt/hgfs/shared/temp/test$ g++ test.cpp && ./a.out
failbit wasn't set, and result is true
Rest of stream is 'bc'.
It seems (from this and other tests), that the implementation stops reading
from 'in' when it founds a sequence that matches one of the target sequences.
But it should test, whether the sequence is a (proper) prefix of another target
sequence. And if it is, the function should continue reading.
This behaviour doesn't follow obviously from the description of the function,
but it follows from the examples.
The detailed bug description can be found at:
http://linuxtesting.org/results/report?num=S0736
--
Summary: Wrong behaviour of num_get<>::do_get(bool) in the case
when one target sequence is a prefix of the other one
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tsyvarev at ispras dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37957
More information about the Gcc-bugs
mailing list