[Bug libstdc++/94749] New: std::istream::ignore discards too many characters
serpent7776 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 24 17:12:38 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94749
Bug ID: 94749
Summary: std::istream::ignore discards too many characters
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: serpent7776 at gmail dot com
Target Milestone: ---
Created attachment 48369
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48369&action=edit
full source example
The following code results in '=' assigned to c when using libstdc++, but '+'
is assigned when using libc++, I believe libc++ is correct here
std::stringstream s(" +=");
char c;
s.ignore(1, '+');
s >> c;
Tested this on godbolt with newest gcc and locally on FreeBSD with gcc7
(command: g++7 -Wall -Wextra -pedantic test.cpp)
https://godbolt.org/z/yS5je8
More information about the Gcc-bugs
mailing list