http://llvm.org/bugs/show_bug.cgi?id=10817
Summary: getline broken, reads an extra line
Product: libc++
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
The following trivial program fails to give the intended results with libc++ —
instead of reading one line from the terminal, it reads two.
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "What is your name: ";
string name;
getline(cin, name);
cout << "Hello " << name << endl;
return 0;
}
Here it is without libcxx:
% clang++ -o hello hello.cpp
% ./hello
What is your name: Miss Marple
Hello Miss Marple
... and here it is with libcxx:
% clang++ -stdlib=libc++ -o hello hello.cpp
% ./hello
What is your name: Miss Marple
... oh noes, I need to type another line ... you do test this stuff, right?
Hello Miss Marple
Tested with current trunk (138853) and with Xcode 4.1.
--
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