[LLVMbugs] [Bug 10817] New: getline broken, reads an extra line
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 30 23:57:10 PDT 2011
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: hhinnant at apple.com
ReportedBy: oneill+llvmbugs at cs.hmc.edu
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list