[Bug libstdc++/70609] std::experimental::filesystem::copy fails if the file size is 0 bytes

2016-04-09 Thread fruko_eto at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70609

--- Comment #1 from furkan  ---
Also worth to note that I've tested a similar program with Boost::Filesystem,
QFile and Poco::File they all worked, so I don't think there is a
system-related bug

[Bug libstdc++/70609] New: std::experimental::filesystem::copy fails if the file size is 0 bytes

2016-04-09 Thread fruko_eto at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70609

Bug ID: 70609
   Summary: std::experimental::filesystem::copy fails if the file
size is 0 bytes
   Product: gcc
   Version: 5.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fruko_eto at hotmail dot com
  Target Milestone: ---

#include 
#include 
int main() {
std::ofstream o("1.txt");
o.close();
std::experimental::filesystem::copy("1.txt", "2.txt");
}


The above code fails and when the exception caught, it gives 

filesystem error: cannot copy: Input/output error [1.txt] [2.txt]
generic:5

It also gives the same error when I create the file with touch instead of
std::ofstream. However, it works when I write something to the & save & delete
everything & save again. After these operations even though file looks empty
its size is 1 byte and it works without a problem.


g++ version 5.3.1 20151207 (Red Hat 5.3.1-2)
Fedora 23

Only parameters given to g++ is -std=c++17 and -lstdc++fs