[Bug libstdc++/71431] New: ifstream::rdbuf directory

2016-06-06 Thread dimaqq at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: dimaqq at gmail dot com Target Milestone: --- Pardon my primitive code: ``` auto utf8 = std::locale(std::locale(), new std::codecvt_utf8); std::wifstream expression(argv[1]); if (!expression) { /* ... */ return 99

[Bug libstdc++/71431] ifstream::rdbuf directory

2016-06-06 Thread dimaqq at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71431 Dima Tisnek changed: What|Removed |Added Status|RESOLVED|NEW Resolution|INVALID

[Bug libstdc++/71431] ifstream::rdbuf directory

2016-06-06 Thread dimaqq at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71431 --- Comment #6 from Dima Tisnek --- Perhaps in my case, it's a combination of directory, `imbue` and `rdbuf` ?

[Bug libstdc++/71431] ifstream::rdbuf directory

2016-06-06 Thread dimaqq at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71431 --- Comment #7 from Dima Tisnek --- Ugh, it never occurred to me to check error on target of buffer copy. `buf.rdstate()` does report an error for me. A bit unexpected and seems like black magic, but the error is there :)

[Bug libstdc++/71431] ifstream::rdbuf directory

2016-06-06 Thread dimaqq at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71431 --- Comment #8 from Dima Tisnek --- Looks like I cannot distinguish between a directory and an empty file: ``` buf << expression.rdbuf(); /* check buf.rdstate() */ ``` underlying file name was a directory -- rdstate() == 4 underlying fi