diff --git a/README.md b/README.md index 2886610..7330593 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ you might use: #ifdef GHC_USE_STD_FS #include + #include namespace fs { using namespace std::filesystem; using ifstream = std::ifstream; @@ -318,6 +319,7 @@ switching like this: #ifdef GHC_USE_STD_FS #include + #include namespace fs { using namespace std::filesystem; using ifstream = std::ifstream; diff --git a/include/ghc/fs_std.hpp b/include/ghc/fs_std.hpp index f09eeec..9eb38ac 100644 --- a/include/ghc/fs_std.hpp +++ b/include/ghc/fs_std.hpp @@ -58,6 +58,7 @@ #ifdef GHC_USE_STD_FS #include + #include namespace fs { using namespace std::filesystem; using ifstream = std::ifstream; diff --git a/include/ghc/fs_std_fwd.hpp b/include/ghc/fs_std_fwd.hpp index 372470f..3114d75 100644 --- a/include/ghc/fs_std_fwd.hpp +++ b/include/ghc/fs_std_fwd.hpp @@ -60,6 +60,7 @@ #ifdef GHC_USE_STD_FS #include + #include namespace fs { using namespace std::filesystem; using ifstream = std::ifstream; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8fec7f2..d8a07ac 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -97,6 +97,14 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) endif() add_test(fwd_impl_test fwd_impl_test) +if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES) + add_executable(fs_std_header_test fs_std_header_test.cpp fs_std_fwd_header_test.cpp) + target_link_libraries(fs_std_header_test ghc_filesystem) + target_compile_features(fs_std_header_test PRIVATE cxx_std_17) + SetTestCompileOptions(fs_std_header_test) + add_test(fs_std_header_test fs_std_header_test) +endif() + add_executable(exception exception.cpp) if(MSVC) # MSVC 2015 warns for noexcept declarations when exception handling is disabled. diff --git a/test/fs_std_fwd_header_test.cpp b/test/fs_std_fwd_header_test.cpp new file mode 100644 index 0000000..132d0ea --- /dev/null +++ b/test/fs_std_fwd_header_test.cpp @@ -0,0 +1,8 @@ +#define GHC_USE_STD_FS +#include + +bool fs_std_fwd_header_test() +{ + fs::fstream stream; + return stream.is_open(); +} diff --git a/test/fs_std_header_test.cpp b/test/fs_std_header_test.cpp new file mode 100644 index 0000000..52b9ba8 --- /dev/null +++ b/test/fs_std_header_test.cpp @@ -0,0 +1,10 @@ +#define GHC_USE_STD_FS +#include + +bool fs_std_fwd_header_test(); + +int main() +{ + fs::ifstream stream; + return stream.is_open() || fs_std_fwd_header_test() ? 1 : 0; +}