http://llvm.org/bugs/show_bug.cgi?id=15154
Bug #: 15154
Summary: istream discards character when unexpected type is met
Product: libc++
Version: 3.2
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
double dd;
std::cin >> dd;
Above code snippet correctly sets cin.fail() when user provides non-double-type
input, such as a character 'x'.
However, when I tried to determine what the problematic input was by the
following code snippet:
std::cin.clear();
char c;
std::cin >> c;
it seems my problematic input 'x' has already discarded and the variable c is
set to ' '; although I expect to see the variable c is set to 'x'.
--
std::ifstream also behaves wrongly the same way.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs