-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!high priorityImportant!Important!
Description
Internal VSO-1841456 / AB#1841456 "[RWC][prod/fe][Regression] ITK failed to run test case itkCSVArray2DFileReaderTest" reported a runtime correctness regression caused by #3773. Here's a fully reduced test case:
D:\GitHub\STL\out\x64>type meow.cpp
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
void test(const ios_base::openmode mode) {
{
ofstream out{"delme.txt", mode};
out << "Line A\n";
out << "Line B\n";
out << "Line C\n";
}
{
ifstream in{"delme.txt"}; // Always reading in text mode!
string line;
for (int i = 0; i < 5 && getline(in, line); ++i) {
cout << "Read: \"" << line << "\"; ";
cout << "in.tellg(): " << in.tellg() << "\n";
}
}
}
int main() {
cout << "Testing a text mode (CRLF) file.\n";
test(ios_base::out);
cout << "--------------------------------\n";
cout << "Testing a binary mode (LF) file.\n";
test(ios_base::binary);
}
Before
D:\GitHub\STL\out\x64>cl /EHsc /nologo /W4 /MTd /Od meow.cpp && meow
meow.cpp
Testing a text mode (CRLF) file.
Read: "Line A"; in.tellg(): 8
Read: "Line B"; in.tellg(): 16
Read: "Line C"; in.tellg(): 24
--------------------------------
Testing a binary mode (LF) file.
Read: "Line A"; in.tellg(): 5
Read: "Line B"; in.tellg(): 13
Read: "Line C"; in.tellg(): 21
After
D:\GitHub\STL\out\x64>cl /EHsc /nologo /W4 /MTd /Od meow.cpp && meow
meow.cpp
Testing a text mode (CRLF) file.
Read: "Line A"; in.tellg(): 8
Read: "Line B"; in.tellg(): 16
Read: "Line C"; in.tellg(): 24
--------------------------------
Testing a binary mode (LF) file.
Read: "Line A"; in.tellg(): 5
Read: "A"; in.tellg(): 5
Read: "A"; in.tellg(): 5
Read: "A"; in.tellg(): 5
Read: "A"; in.tellg(): 5
JMazurkiewicz and cpplearner
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!high priorityImportant!Important!