This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream
- From: Ross Smith <ross dot smith at otoy dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 11 Jun 2018 14:11:58 +1200
- Subject: Re: GCC 7.3.0 -std=gnu++17 failed to getline() from std::ifstream
- Newsgroups: gmane.os.cygwin
- References: <CAHVoUt2pHP46o6ERwx9HB5=Dn-J9xv5i-53RYtJbdev-K9DCeQ@mail.gmail.com> <a7b8e684-f985-f8f2-c7f2-79e618e8ece1@gmail.com>
On 2018-06-06 09:00, Marco Atzeri wrote:
On 6/5/2018 10:32 PM, Ivan Shynkarenka wrote:
Hello
I use x64 bit Cygwin and it failed in my home, work and Appveyor. I add
cygcheck.out with my environment.
I'm sorry about misspell prefix space in my prev example. Please try the
following one:
#include <fstream>
#include <iostream>
int main(int argc, char** argv)
{
std::string line;
std::ifstream stream("test.cpp");
while (getline(stream, line))
std::cout << line << std::endl;
return 0;
}
g++ -std=gnu++17 test.cpp
works fine on 32 bit and 64 bit on my W7
I'm having the same problem. My test program:
#include <fstream>
#include <iostream>
int main() {
std::ifstream in("demo.cpp");
std::string line;
for (;;) {
std::getline(in, line);
if (! in && line.empty())
break;
std::cout << line << "\n";
}
}
$ g++ demo.cpp -std=c++17 -o demo && ./demo
Aborted (core dumped)
It's crashing on the call to std::getline(). It only happens in
-std=gnu++17 mode (or the equivalent gnu++1z, or c++17/1z). If I
compile with -std=gnu++14 or lower it works. I'm using 64-bit
Cygwin, everything updated to the current release, on Windows 8.1.
Ross Smith
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple