From d584da3347f54a79a9053f966be6cd0ef43e7484 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 22:35:48 -0700 Subject: [PATCH 1/9] Move: tests/std/include/experimental_filesystem.hpp --- .../filesystem => tests/std/include/experimental_filesystem.hpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stl/inc/experimental/filesystem => tests/std/include/experimental_filesystem.hpp (100%) diff --git a/stl/inc/experimental/filesystem b/tests/std/include/experimental_filesystem.hpp similarity index 100% rename from stl/inc/experimental/filesystem rename to tests/std/include/experimental_filesystem.hpp From 476b22a1f3aad68da9eb076256a91ed1cf08ec9a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 22:48:41 -0700 Subject: [PATCH 2/9] Add a cryostasis banner. --- tests/std/include/experimental_filesystem.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/std/include/experimental_filesystem.hpp b/tests/std/include/experimental_filesystem.hpp index dffae927880..e9bd384243d 100644 --- a/tests/std/include/experimental_filesystem.hpp +++ b/tests/std/include/experimental_filesystem.hpp @@ -3,6 +3,12 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// ******************************************************************************************************************** +// * This was previously shipped in product code as . * +// * It's now preserved in cryostasis for test code to exercise functions that are retained for binary compatibility. * +// * This file should generally not be changed, except to fix compiler warnings/errors and to update clang-format. * +// ******************************************************************************************************************** + #ifndef _EXPERIMENTAL_FILESYSTEM_ #define _EXPERIMENTAL_FILESYSTEM_ #include From d80319b790d952adf3be2f7e59688254307d8f0b Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 22:50:43 -0700 Subject: [PATCH 3/9] Remove `` from product code. If someone's looking at Standard filesystem.cpp, we don't need to keep a comment pointing out Experimental filesys.cpp. --- stl/CMakeLists.txt | 1 - stl/inc/__msvc_all_public_headers.hpp | 4 ---- stl/src/filesystem.cpp | 1 - 3 files changed, 6 deletions(-) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 66bead9e16a..f91c4ad9142 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -73,7 +73,6 @@ set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/inc/execution ${CMAKE_CURRENT_LIST_DIR}/inc/expected ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/coroutine - ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/filesystem ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/generator ${CMAKE_CURRENT_LIST_DIR}/inc/experimental/resumable ${CMAKE_CURRENT_LIST_DIR}/inc/filesystem diff --git a/stl/inc/__msvc_all_public_headers.hpp b/stl/inc/__msvc_all_public_headers.hpp index e05d9e5dc32..2a59dece937 100644 --- a/stl/inc/__msvc_all_public_headers.hpp +++ b/stl/inc/__msvc_all_public_headers.hpp @@ -29,7 +29,6 @@ #endif // !defined(_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING) #define _SILENCE_CXX20_CISO646_REMOVED_WARNING -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS // Core STL Headers @@ -158,9 +157,6 @@ #include #include -// Non-Core Experimental Headers -#include - #endif // !defined(_CORE_HEADERS_ONLY) #ifndef _MSVC_TESTING_NVCC diff --git a/stl/src/filesystem.cpp b/stl/src/filesystem.cpp index 4dbf0183b83..46d37feb872 100644 --- a/stl/src/filesystem.cpp +++ b/stl/src/filesystem.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // filesystem.cpp -- C++17 implementation -// (see filesys.cpp for implementation) #include #include From b7bbc3e12f9a277a7cc1809f48fcd76a6c6afbfe Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 4 Oct 2025 13:48:02 -0700 Subject: [PATCH 4/9] Remove the feature-test macro `__cpp_lib_experimental_filesystem`. I don't think it's necessary to transfer this to the cryopreserved experimental_filesystem.hpp. --- stl/inc/yvals_core.h | 2 -- .../tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 1ebbeb3676e..90cf69194c6 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1937,8 +1937,6 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect #define __cpp_lib_variant 202102L // P2162R2 Inheriting From variant #endif -#define __cpp_lib_experimental_filesystem 201406L - #ifdef _RTC_CONVERSION_CHECKS_ENABLED #ifndef _ALLOW_RTCc_IN_STL #error /RTCc rejects conformant code, so it is not supported by the C++ Standard Library. Either remove this \ diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp index 1f88a25ff9c..fe5fbd82a9a 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0157762_feature_test_macros/test.compile.pass.cpp @@ -345,8 +345,6 @@ STATIC_ASSERT(__cpp_lib_expected == 202211L); #error __cpp_lib_expected is defined #endif -STATIC_ASSERT(__cpp_lib_experimental_filesystem == 201406L); - #if _HAS_CXX17 STATIC_ASSERT(__cpp_lib_filesystem == 201703L); #elif defined(__cpp_lib_filesystem) From 5a8a78139e2c2bb4bd79daf4deb6d3102d6c175e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 4 Oct 2025 14:06:34 -0700 Subject: [PATCH 5/9] Remove `_FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM`, simplify Standard `filesystem::path` detection. After removing support for `experimental::filesystem::path`, we can simplify away `_Is_any_path`. Now, those constructors can be guarded for `_HAS_CXX17`, and they can use `is_same_v` exactly as depicted by N5014 [ifstream.cons]/4, [ofstream.cons]/4, [fstream.cons]/4. They remain templates, so there's no ABI impact to their definitions completely vanishing in C++14 mode. --- stl/inc/__msvc_filebuf.hpp | 41 +------------------------------------- stl/inc/fstream | 41 +++++++++----------------------------- 2 files changed, 10 insertions(+), 72 deletions(-) diff --git a/stl/inc/__msvc_filebuf.hpp b/stl/inc/__msvc_filebuf.hpp index 7b2846b020c..009265e0a19 100644 --- a/stl/inc/__msvc_filebuf.hpp +++ b/stl/inc/__msvc_filebuf.hpp @@ -18,7 +18,7 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -// TRANSITION, ABI: The _Path_ish functions accepting filesystem::path or experimental::filesystem::path are templates +// TRANSITION, ABI: The _Path_ish functions accepting filesystem::path are templates // which always use the same types as a workaround for user code deriving from iostreams types and // __declspec(dllexport)ing the derived types. Adding member functions to iostreams broke the ABI of such DLLs. // Deriving and __declspec(dllexport)ing standard library types is not supported, but in this particular case @@ -31,36 +31,6 @@ namespace filesystem { } #endif // _HAS_CXX17 -#ifndef _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -#ifdef _M_CEE -#define _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM 0 -#else // ^^^ defined(_M_CEE) / !defined(_M_CEE) vvv -#define _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM 1 -#endif // ^^^ !defined(_M_CEE) ^^^ -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -namespace experimental { - namespace filesystem { - inline namespace v1 { - class path; - } - } // namespace filesystem -} // namespace experimental -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - -template -constexpr bool _Is_any_path = _Is_any_of_v<_Ty -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - , - experimental::filesystem::path -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM -#if _HAS_CXX17 - , - filesystem::path -#endif // _HAS_CXX17 - >; - extern "C++" _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const char*, ios_base::openmode, int); extern "C++" _CRTIMP2_PURE FILE* __CLRCALL_PURE_OR_CDECL _Fiopen(const wchar_t*, ios_base::openmode, int); @@ -325,15 +295,6 @@ class basic_filebuf : public basic_streambuf<_Elem, _Traits> { // stream buffer return open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - basic_filebuf* open( - const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode, int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - return open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template basic_filebuf* open( diff --git a/stl/inc/fstream b/stl/inc/fstream index bb6060f0cfd..cbae7586dbc 100644 --- a/stl/inc/fstream +++ b/stl/inc/fstream @@ -54,10 +54,12 @@ public: const wstring& _Str, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot) : basic_ifstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_ifstream( const _Ty& _Path, ios_base::openmode _Mode = ios_base::in, int _Prot = ios_base::_Default_open_prot) : basic_ifstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_ifstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -102,15 +104,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in, - int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in, @@ -207,10 +200,12 @@ public: const wstring& _Str, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_ofstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_ofstream( const _Ty& _Path, ios_base::openmode _Mode = ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_ofstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_ofstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -255,15 +250,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out, - int _Prot = ios_base::_Default_open_prot) { - // _Prot is an extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::out, @@ -365,10 +351,12 @@ public: int _Prot = ios_base::_Default_open_prot) : basic_fstream(_Str.c_str(), _Mode, _Prot) {} // extension - template , int> = 0> +#if _HAS_CXX17 + template , int> = 0> explicit basic_fstream(const _Ty& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, int _Prot = ios_base::_Default_open_prot) : basic_fstream(_Path.c_str(), _Mode, _Prot) {} // _Prot is an extension +#endif // _HAS_CXX17 explicit basic_fstream(FILE* _File) : _Mybase(_STD addressof(_Filebuffer)), _Filebuffer(_File) {} // extension @@ -414,15 +402,6 @@ public: open(_Str.c_str(), _Mode, _Prot); } -#if _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - template - void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, - int _Prot = ios_base::_Default_open_prot) { - // extension - open(_Path.c_str(), _Mode, _Prot); - } -#endif // _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #if _HAS_CXX17 template void open(const _Identity_t<_Path_ish>& _Path, ios_base::openmode _Mode = ios_base::in | ios_base::out, @@ -487,8 +466,6 @@ void swap(basic_fstream<_Elem, _Traits>& _Left, basic_fstream<_Elem, _Traits>& _ } _STD_END -#undef _FSTREAM_SUPPORTS_EXPERIMENTAL_FILESYSTEM - #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) From ef4653646c581e786fce9471978a8cafb156ab01 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 23:29:37 -0700 Subject: [PATCH 6/9] Update src/filesys.cpp to compile standalone. Add a TRANSITION, ABI comment. We don't need to define the silencing macro, because we can't include `` anymore. We use `wstring`, so we need to include ``. (This was previously dragged in, at least partially.) We use `uint64_t` and `uintmax_t`, so we should include `` to be good kitties. We need the `_MAX_FILESYS_NAME`, `_FS_BEGIN`, and `_FS_END` macros. Within the namespace, we need `file_type`, `perms` and its `_BITMASK_OPS`, and `space_info`. --- stl/src/filesys.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/stl/src/filesys.cpp b/stl/src/filesys.cpp index ee8a061383e..eff04e50ff6 100644 --- a/stl/src/filesys.cpp +++ b/stl/src/filesys.cpp @@ -4,17 +4,32 @@ // filesys.cpp -- implementation // (see filesystem.cpp for C++17 implementation) -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING +// TRANSITION, ABI: Everything in this file is preserved for binary compatibility. #include +#include #include #include -#include #include +#include #include +#define _MAX_FILESYS_NAME 260 // longest Windows or Posix filename + 1 + +#define _FS_BEGIN \ + _STD_BEGIN \ + namespace experimental { \ + namespace filesystem { \ + inline namespace v1 { + +#define _FS_END \ + } \ + } \ + } \ + _STD_END + #ifdef _M_CEE_PURE #define __crtGetTempPath2W(BufferLength, Buffer) GetTempPathW(BufferLength, Buffer) #else // vvv !defined(_M_CEE_PURE) vvv @@ -23,6 +38,53 @@ extern "C" _Success_(return > 0 && return < BufferLength) DWORD __stdcall __crtG #endif // ^^^ !defined(_M_CEE_PURE) ^^^ _FS_BEGIN + +enum class file_type { // names for file types + not_found = -1, + none, + regular, + directory, + symlink, + block, + character, + fifo, + socket, + unknown +}; + +enum class perms { // names for permissions + none = 0, + owner_read = 0400, // S_IRUSR + owner_write = 0200, // S_IWUSR + owner_exec = 0100, // S_IXUSR + owner_all = 0700, // S_IRWXU + group_read = 040, // S_IRGRP + group_write = 020, // S_IWGRP + group_exec = 010, // S_IXGRP + group_all = 070, // S_IRWXG + others_read = 04, // S_IROTH + others_write = 02, // S_IWOTH + others_exec = 01, // S_IXOTH + others_all = 07, // S_IRWXO + all = 0777, + set_uid = 04000, // S_ISUID + set_gid = 02000, // S_ISGID + sticky_bit = 01000, // S_ISVTX + mask = 07777, + unknown = 0xFFFF, + add_perms = 0x10000, + remove_perms = 0x20000, + resolve_symlinks = 0x40000 +}; + +_BITMASK_OPS(_EMPTY_ARGUMENT, perms) + +struct space_info { // space information for a file + uintmax_t capacity; + uintmax_t free; + uintmax_t available; +}; + static file_type _Map_mode(int _Mode) { // map Windows file attributes to file_status constexpr int _File_attribute_regular = FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_HIDDEN From fc20b642646335b96b7d343ab59d1a2fc8576aa2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 22:55:11 -0700 Subject: [PATCH 7/9] Drop coverage in include_each_header_alone_matrix.lst. --- tests/std/tests/include_each_header_alone_matrix.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/std/tests/include_each_header_alone_matrix.lst b/tests/std/tests/include_each_header_alone_matrix.lst index b642cb11c6c..b2798e243c1 100644 --- a/tests/std/tests/include_each_header_alone_matrix.lst +++ b/tests/std/tests/include_each_header_alone_matrix.lst @@ -120,4 +120,3 @@ PM_CL="/DMEOW_HEADER=cwchar" PM_CL="/DMEOW_HEADER=cwctype" PM_CL="/DMEOW_HEADER=hash_map /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS" PM_CL="/DMEOW_HEADER=hash_set /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS" -PM_CL="/DMEOW_HEADER=experimental/filesystem /D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING" From a4acd3620f5872a4def9822812425dbb086e1166 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 3 Oct 2025 22:59:44 -0700 Subject: [PATCH 8/9] Update test coverage to include experimental_filesystem.hpp. tests/tr1/tests/filesystem1/test.cpp is still allowed to say that it's testing ``; rephrasing this wasn't worth the effort. --- tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp | 3 ++- tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp | 2 +- tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp | 3 ++- .../test.compile.pass.cpp | 3 +-- tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp | 2 +- .../test.cpp | 3 ++- tests/tr1/tests/filesystem1/test.cpp | 3 ++- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp index b548e3d443d..60ba4716aeb 100644 --- a/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp +++ b/tests/std/tests/Dev11_0000000_null_forward_iterators/test.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -31,6 +30,8 @@ #include #endif // _HAS_CXX20 +#include "experimental_filesystem.hpp" + using namespace std; // N3797 24.2.5 [forward.iterators]/2: diff --git a/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp b/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp index a21fb335a6f..7d02f077bad 100644 --- a/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp +++ b/tests/std/tests/Dev11_1066931_filesystem_rename_noop/test.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -16,6 +15,7 @@ #include #endif // _HAS_CXX17 +#include "experimental_filesystem.hpp" #include using namespace std; diff --git a/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp b/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp index 24abba9e72b..bc8b89c6320 100644 --- a/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp +++ b/tests/std/tests/Dev11_1180290_filesystem_error_code/test.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,8 @@ #include #endif // _HAS_CXX17 +#include "experimental_filesystem.hpp" + using namespace std; using namespace std::chrono; diff --git a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp index ff5f35e3424..146dcce6d33 100644 --- a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp @@ -106,8 +106,7 @@ #include #endif // _M_CEE_PURE -#include - +#include "experimental_filesystem.hpp" #include diff --git a/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp b/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp index dcdbc072202..1a9f7fb25c2 100644 --- a/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp +++ b/tests/std/tests/VSO_0000000_path_stream_parameter/test.cpp @@ -4,11 +4,11 @@ #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include -#include #include #include #include +#include "experimental_filesystem.hpp" #include using namespace std; diff --git a/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp b/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp index a35303fde30..17517082f0b 100644 --- a/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp +++ b/tests/std/tests/VSO_0121275_filesystem_canonical_should_handle_many_double_dots/test.cpp @@ -8,10 +8,11 @@ #include #include #include -#include #include #include +#include "experimental_filesystem.hpp" + using namespace std; namespace fs = std::experimental::filesystem; diff --git a/tests/tr1/tests/filesystem1/test.cpp b/tests/tr1/tests/filesystem1/test.cpp index 1a79e04fc19..1f7f78eba93 100644 --- a/tests/tr1/tests/filesystem1/test.cpp +++ b/tests/tr1/tests/filesystem1/test.cpp @@ -7,10 +7,11 @@ #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include "tdefs.h" -#include #include #include +#include "experimental_filesystem.hpp" + #define TMP_NAME(suf) "tmp_name" suf #define CHECK_TBL(str, field) CHECK_STRING(native_to_char(str), fix_bslash(STD string(field))) From 2f7bb6f16fa8a1f7051142ab1c102a2a0ed174b9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Sat, 4 Oct 2025 14:26:30 -0700 Subject: [PATCH 9/9] Update Dev09_172666_tr1_tuple_odr to include experimental_filesystem.hpp and dual-mode test Standard filesystem. It was previously dragging in `` via `<__msvc_all_public_headers.hpp>`, which is why I missed it in #5749. --- .../tests/Dev09_172666_tr1_tuple_odr/test.cpp | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp b/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp index c57ae88c8be..203ade46b08 100644 --- a/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp +++ b/tests/std/tests/Dev09_172666_tr1_tuple_odr/test.cpp @@ -1,26 +1,31 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING + #include <__msvc_all_public_headers.hpp> #include -namespace fs = std::experimental::filesystem; +#include "experimental_filesystem.hpp" int meow(); -inline bool test_wchar_t_minus() { - // Test for DevDiv-1004799: : /Zc:wchar_t- fails. Calling file_size - // should cause the failure to occur if we are wchar_t incorrect. Test is disabled - // (i.e. always passes) if compiled with /clr:pure and /Zc:wchar_t-, as it triggers - // LNK2031: calling convention missing in metadata errors, which are irrelevant here. -#if defined(_M_CEE_PURE) && !defined(_NATIVE_WCHAR_T_DEFINED) - return true; -#else // ^^^ /clr:pure /Zc:wchar_t- / Other vvv - return fs::file_size(fs::current_path() / "Dev09_172666_tr1_tuple_odr.exe") != 0u; -#endif // defined(_M_CEE_PURE) && !defined(_NATIVE_WCHAR_T_DEFINED) -} - int main() { assert(meow() == 1729); - assert(test_wchar_t_minus()); + + // Test for DevDiv-1004799: : /Zc:wchar_t- fails. + // Calling file_size should cause the failure to occur if we are wchar_t incorrect. +#if defined(_M_CEE_PURE) && !defined(_NATIVE_WCHAR_T_DEFINED) + // Test is disabled if compiled with /clr:pure and /Zc:wchar_t-, as it triggers + // LNK2031: calling convention missing in metadata errors, which are irrelevant here. +#else // ^^^ workaround / no workaround vvv + { + namespace fs = std::experimental::filesystem; + assert(fs::file_size(fs::current_path() / "Dev09_172666_tr1_tuple_odr.exe") != 0u); + } + +#if _HAS_CXX17 + assert(std::filesystem::file_size(std::filesystem::current_path() / "Dev09_172666_tr1_tuple_odr.exe") != 0u); +#endif // _HAS_CXX17 +#endif // ^^^ no workaround ^^^ }