GCC (10.0.1) and Clang (11.0.0)/MSVC (VS 16.4.3) show different behavior concerning std::filesystem::create_directories() when a non-existing path with a trailing slash is given as argument.
More precisely, while all three compilers indeed create the directory, the latter two return false in that case, making the return value of std::filesystem::create_directories() ambigous (and counter-intuitive).
Specifically, if no file exists at path "a/b/c", then the following program,
#include <filesystem>
#include <iostream>
int main() {
std::cout << std::boolalpha << std::filesystem::create_directories("a/b/c/");
}
creates a directory at that path, but prints false under Clang/MSVC while true under GCC.
Which is the correct behavior?