#2885: test for std::filesystem availability in Silo output likely broken
Reporter:Roland Haas
Status:new
Milestone:
Version:
Type:bug
Priority:minor
Component:

The test

#if defined __cpp_lib_filesystem && __cpp_lib_filesystem < 201703L
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif

(or so) in the Silo output routines is quite likely not performing as intended.

Namely

  1. __cpp_lib_filesystem is defined either in <version> (C++20) or in <filesystem> (which is what we want to test for)
  2. if defined (at least in g++12) it is set to the constant 201703L anyway

References:
* https://en.cppreference.com/w/cpp/feature_test.html (though g++ does provide a version file even in version of gcc that do not support C++20 and also when C++20 is not the language version used)
* https://stackoverflow.com/a/53365539 which is somewhat more complex than we’d want, and also would require access to <version>.

The current workaround exists b/c of old gcc versions (7 apparently) and also for some clusters where the (AMD / clang / hip) compiler is old.

‌

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2885/test-for-std-filesystem-availability-in