https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118699

            Bug ID: 118699
           Summary: [MinGW] std::filesystem::copy doesn't work when the
                    second argument is a directory and the first one is a
                    file
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamsupermouse at mail dot ru
  Target Milestone: ---

The bug only happens on MinGW.

This code:

    #include <filesystem>

    int main()
    {
        std::filesystem::copy("a/b.txt", "c");
    }

(`a/b.txt` and the `c` directory must exist)

Throws `File exists` on MinGW. While on Linux it successfully creates
`c/b.txt`.

Judging from https://en.cppreference.com/w/cpp/filesystem/copy, the Linux
behavior is correct and the MinGW behavior is bugged.

Reply via email to