Skip to content

VS 2022 17.4

Compare
Choose a tag to compare
@StephanTLavavej StephanTLavavej released this 09 Mar 05:26
· 957 commits to main since this release
af8adfa
  • Merged C++23 features:
  • Merged LWG issue resolutions:
    • LWG-3564 #2961 transform_view::iterator<true>::value_type and iterator_category should use const F&
    • LWG-3617 #2966 function/packaged_task deduction guides and deducing this
    • LWG-3656 #2880 Inconsistent bit operations returning a count
    • LWG-3671 #2905 atomic_fetch_xor missing from stdatomic.h
    • LWG-3672 #2907 common_iterator::operator->() should return by value
    • LWG-3683 #2879 operator== for polymorphic_allocator cannot deduce template argument in common cases
    • LWG-3701 #2957 Make formatter<remove_cvref_t<const charT[N]>, charT> requirement explicit
    • LWG-3707 #2883 chunk_view::outer-iterator::value_type::size should return unsigned type
    • LWG-3710 #2878 The end of chunk_view for input ranges can be const
    • LWG-3712 #2943 chunk_view and slide_view should not be default_initializable
    • LWG-3715 #2946 view_interface::empty is overconstrained
    • LWG-3719 #2902 Directory iterators should be usable with default sentinel
    • LWG-3721 #2906 Allow an arg-id with a value of zero for width in std-format-spec
    • LWG-3724 #2903 decay-copy should be constrained
  • Merged proposed resolutions for LWG issues (not yet accepted for the C++ Working Draft, but we've chosen to implement this speculatively):
    • LWG-3705 #2741 Hashability shouldn't depend on basic_string's allocator
  • Fixed bugs:
    • Fixed linker errors when using <any> with our unofficially supported mode to disable exceptions. #2193
    • Fixed compiler errors when using <format> with the new compiler option /presetPadding by adding a compiler bug workaround. #2746
    • Fixed division by complex zero to behave consistently with other implementations. #2758
    • Fixed a memory leak in <syncstream>. #2763
    • Fixed compiler errors when formatting long or unsigned long values with formatter. #2768
    • Fixed a binary compatibility break in the unordered associative containers, which could cause memory corruption when linking code that was built with different versions of the STL. #2774
      • Original Versions: VS 2015 through VS 2019 16.2 inclusive.
      • Modified Versions: VS 2019 16.3 through VS 2022 17.3 inclusive.
      • Fixed Versions: VS 2022 17.4 and later.
      • The bincompat break happened when mixing Original with Modified code. All other mixing is safe: Original with Original, Modified with Modified, Fixed with Fixed, Original with Fixed, and Modified with Fixed.
    • Fixed a bug in the unordered associative containers, specific to user-defined allocators, where the containers sometimes called deallocate() with null pointers. User-defined allocators aren't required to tolerate that, so the containers now avoid such calls. #2790
    • Fixed a bug in deque, specific to rarely-used fancy pointers, where some fancy pointers weren't being destroyed. #2775
    • <chrono> formatting now accepts %x ("The locale's date representation") for year_month_day, year_month_day_last, year_month_weekday, and year_month_weekday_last. #2762
    • std::filesystem::directory_entry's constructors, assign(), and replace_filename() now call refresh() as required by the Standard and will propagate any errors (via exceptions or error_codes), except that "file not found" is not considered an error. #1343
    • Added a compiler bug workaround to construct_at(), allowing immovable objects to be emplaced via copy elision. #2624
    • Fixed leap second validation when parsing time_points. #2705
    • lerp() now avoids overflowing to infinity when it can calculate the correct result with a fallback approach. #1918
    • Fixed a debugger visualization issue, specific to Clang in C++20 mode (or later), where the debugger wouldn't display the contents of a list, forward_list, or ordered/unordered associative container. #2782
    • Fixed the visualizers for the non-Standard stdext::hash_map container family. #2784
    • Fixed the visualizers for make_shared() and allocate_shared(). #2811
    • put_time() (and the time_put::do_put() machinery powering it) now avoids modifying errno when it succeeds. #2049
    • Added a compiler bug workaround to fix compiler errors with source_location::current() in certain scenarios. #2824
    • Fixed compiler errors when using <format> to print durations with extremely small periods (e.g. femtoseconds, attoseconds). #2814
    • Fixed "istreambuf_iterator is not dereferenceable" assertions when attempting to use time_get::get() or get_time() to parse certain formats when there's insufficient input. #2851
      • For example, with the format "%X", the input "3:04:05" succeeds. The input "3:04" previously asserted/crashed; now it sets ios_base::failbit | ios_base::eofbit as required by the Standard.
    • Removed std::filesystem::directory_entry::clear_cache(), which was a non-Standard extension. #2854
    • Fixed incorrect results from <complex> log()/log10()/pow() on ARM64. #2870
    • Fixed path::lexically_relative() to handle UNC drive paths like \\?\C:\meow.txt. #2867
    • Fixed filesystem::read_symlink() and filesystem::copy() to handle junctions. #2877
    • Fixed compiler errors in ranges::uninitialized_copy_n and ranges::uninitialized_move_n with certain input iterators. #2964
    • Fixed ranges::enable_view to properly reject references and to avoid compiler errors in certain unusual situations. #2978
    • Temporarily disabled ASan (Address Sanitizer) annotations in <string> while significant bugs are under investigation. #2990
    • Fixed compiler errors in views::chunk_by with unusual predicates returning non-bool types. #2890
    • Fixed compiler errors in visit<R>() involving conversions to immovable types. #2971 #2999
    • Fixed compiler errors in chrono::abs() in certain unusual situations. #2988
    • Fixed <format> to always print NaNs as "nan", "-nan", or uppercase versions as required by the Standard, never "-nan(ind)". #3001
    • Fixed ranges::shuffle and ranges::sample to accept uniform_random_bit_generators that don't provide result_type. #3002
    • Fixed vector<bool>::insert(where, first, last) and vector<bool>::insert_range(where, range) to meet the Standard's complexity requirements. #3021
    • Fixed how chunk_view and stride_view iterators validate their preconditions. #3023
    • Fixed a compiler warning emitted by the unusual scenario of basic_string_view<char_like_struct>. #3032
    • Fixed move_only_function to behave correctly when passed between DLLs. #3038
    • Fixed compiler errors when dllexporting classes derived from pair or tuple. #3045
      • This fixed a regression that was introduced by #2687 implementing P2321R2's changes to pair and tuple in VS 2022 17.3.
    • Fixed <regex> integer overflows when parsing huge numbers in backreferences, braced repetitions, and decimal escapes. #2169
      • These will now properly throw regex_errors with codes of error_backref, error_badbrace, and error_escape, respectively.
    • Fixed ranges::distance to follow the Standard, which depicts two overloads (for sized and unsized sentinels). #2987
    • Overhauled how the STL unwraps iterators and sentinels, fixing various issues. #3024
    • basic_string::substr() now uses a default-constructed allocator as required by the Standard. #3057
    • Fixed CUDA compiler errors with std::_Bit_cast by using __builtin_bit_cast instead of a memcpy workaround. #3066
  • Improved performance:
    • Improved clamp() codegen with conditional move instructions. #2336
    • Massively improved iostreams performance for signed char, unsigned char, char8_t, and byte elements, matching the performance of char by avoiding a slow codepath. #2739
    • vector's range constructor, insert(), and assign() now efficiently handle iterators that satisfy the forward_iterator concept, even when their classic iterator_category isn't convertible to forward_iterator_tag. #1794
    • Reduced the size of the lookup tables used for <format> grapheme clusterization, saving 2670 bytes. #2757
    • std::filesystem::path::lexically_relative() now avoids unnecessary memory allocations. #1915
    • Added vectorized implementations of min_element(), max_element(), minmax_element(), ranges::min_element(), ranges::max_element(), and ranges::minmax_element(), with speedups ranging from 1.5x to 26.6x (times, not percent). #2447 #2821 #2825
    • Reduced binary size for programs using atomic::wait. #2781
    • Avoided an unnecessary OS call in thread::join(). #2820
    • VS 2022 doesn't support targeting Windows Vista and Server 2008, but the STL still had runtime branches for those unsupported OSes. We've removed that code to improve performance, notably in mutex::try_lock(). #2317
      • The STL still supports targeting Windows 7 and Server 2008 R2.
    • Removed more unused code for Windows XP/Vista, reducing the size of the STL's DLL by 2 KB, and reducing the number of OS calls during STL startup. #2841
    • Reduced the number of OS calls in filesystem::resize_file() and experimental::filesystem::resize_file(). #2771
    • Improved the optimized codegen for T + complex<T>, T * complex<T>, complex<T> * T, and complex<T> / T. Improved the debug codegen for complex<T> + T and complex<T> - T. #2855
    • Improved the optimized codegen for unreachable(). #3055
  • Improved throughput:
    • Used if constexpr instead of tag dispatch in:
      • get<I>() and get<T>() for pair. #2756
    • optional, pair, and tuple now use conditional explicit instead of SFINAE in all Standard modes, for all supported compilers. #2796
    • The STL now uses "hidden friends" for all operators that are required to exist but aren't required to be namespace-scope functions (e.g. n + vector::iterator). This improves throughput by not polluting unqualified name lookup. #2797
    • <charconv>'s large lookup tables are now separately compiled, so translation units including <charconv> will emit significantly smaller object files. #2125
    • The STL now uses helper function templates for testing bitmask types, replacing a significant number of function overloads. #2865
    • <unordered_map> and <unordered_set> now avoid including most of <string>. #2996
      • This also improves throughput for <functional>, which internally uses <unordered_map> to implement boyer_moore_searcher.
      • Escape hatch: define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS. #3027
    • <functional> now avoids including <memory>. #2998
      • Escape hatch: define _LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY. #3027
  • Enhanced behavior:
    • <tuple> is now a core header. #2730
    • The STL now supports enabling C++20 char8_t in C++14 and C++17 modes via /Zc:char8_t. #2748
    • complex<NonFloating> now emits a deprecation warning explaining that it has unspecified behavior according to the Standard. #2759
    • When wchar_t is a real type, the STL now avoids emitting many specializations for unsigned short that are intended for fake wchar_t only (i.e. the non-Standard /Zc:wchar_t- option). #2164
    • The STL now marks all of its namespace-scope constexpr variables as inline in C++17-and-later mode. #2792
      • This consistency improvement will also avoid emitting a new compiler warning that MSVC is implementing for C++20 header units: "warning C5260: the constant variable 'std::_Meow' has internal linkage in an included header file context, but external linkage in imported header unit context; consider declaring it 'inline' as well if it will be shared across translation units, or 'static' to express intent to use it local to this translation unit".
    • constexpr basic_string now uses the Small String Optimization. #1735
    • error_codes with 0 values and future_category or iostream_category now return "success" from message(), matching the behavior of generic_category. #2742
    • <system_error> now maps: #2744 #2899
      • WAIT_TIMEOUT, ERROR_TIMEOUT, and ERROR_SEM_TIMEOUT to errc::timed_out
      • ERROR_BAD_NET_NAME to errc::no_such_file_or_directory
      • ERROR_FILENAME_EXCED_RANGE to errc::filename_too_long
    • Added visualizers for unique_ptrs and vectors storing character sequences. #2843
    • Added more visualizers for <any>, <format>, <functional>, <mutex>, and <ranges>. #2191
    • <cstdlib> now makes its using-declarations for std::getenv() and std::system() available to UWP apps. #2850
    • <filesystem> and <experimental/filesystem> now use GetTempPath2W() when it's available on Windows 11. #2302
      • This is a security improvement for processes running as SYSTEM; there's no behavioral change for ordinary processes.
      • Follow-up: Fixed linker errors involving _Init_locks::operator= in unusual situations. #3011
    • Added a couple of warning numbers for easier lookup: #2061
      • STL4038 warns "The contents of <meow> are available only with C++NN or later."
      • STL4039 warns "The contents of <coroutine> are not available with /await."
    • <unordered_map> and <unordered_set> no longer provide a non-Standard hash_compare class template in namespace std. #2996
    • Improved how STL error messages (like "Unexpected compiler version") are displayed. #2897
    • Further improved how STL warnings and errors are displayed. #2973
    • Added explanations to the STL's [[nodiscard]] warnings, when the compiler supports [[nodiscard("message")]] and the reason is more complex than the common/simple scenario of pure observers. #2211
      • For example, discarding the return value of std::remove_if() now emits a detailed warning message, explaining the classic erase-remove idiom, and suggesting C++20 std::erase_if() instead.
    • vector::assign(num, val) and std::swap_ranges() now have debug checks for forbidden aliasing. #1263
    • Strengthened exception specifications on:
      • Iterator machinery. #1347 #2991
      • <optional> and the classic comparison function objects (less<T>, equal_to<T>, etc.). #1937 #3041
    • Added support for defining _ENFORCE_ONLY_CORE_HEADERS, limiting STL usage to the subset of core headers. #2068
    • Updated the STL's internal 128-bit integer-class types for C++14/17 compatibility, which will be useful for future performance work. #3036
  • Improved test coverage:
    • Enabled tests now that Clang 14 supports <coroutine>. #2861
    • Slightly accelerated test runs by running memory leak tests with only debug configurations (where memory leak tracking is available). #2853
    • Fixed a test that failed at runtime on ARM64. #2864
    • Added /permissive configurations to tests that can successfully compile in this discouraged-but-supported mode. #3015
    • Taught VSCode's Python extension where to find our test support machinery. #3040
    • Updated the <source_location> test for an upcoming compiler fix. #3046
    • Added test coverage for a <string> bug (specific to ASan annotations being enabled) that was fixed. #3039
  • Code cleanups:
    • Removed compiler bug workarounds. #2791 #2861
    • Various cleanups (described in detail in the PRs, not repeated here). #2798 #2801 #2802 #2815 #2766 #2828 #2863 #2950 #3019
    • Removed visualizers for VS 2013's binary-incompatible representations of various data structures. #2804
    • Simplified tuple_cat()'s implementation. #2833
    • Improved how <system_error> maps Windows error codes to errc values. #2837
    • Refactored <atomic> to share code with C11 atomics (work in progress). #2846
    • Updated most files (with limited exceptions) to consistently include the <cmeow> wrapper headers instead of the <meow.h> CRT headers. #2852
    • Simplified <random>'s static constexpr data members. #3006
    • Finished changing all aliases from typedef to using. #3018
    • Cleaned up several tests to avoid unnecessary dependencies on macros and non-Standard code. #3034
    • Updated <functional> and <memory> to consistently use modern int = 0 SFINAE. #2124
    • Cleaned up feature-test macro usage to be simpler and more consistent. #3053
  • Improved documentation:
    • Added a comment explaining why basic_string doesn't use templated static constexpr data members as internal helpers. #2980
  • Infrastructure improvements:
    • Eliminated duplicate builds of the "alias objects". #2743
    • Fixed distributed test runs to split up the test suite deterministically, avoiding missed or repeated tests. #2795
    • Properly applied /analyze to PR/CI builds, and fixed warnings in the STL's separately compiled sources. #2812
    • Fixed cross-PR/CI contamination by cleaning both before and after checkout. #2832
    • Fixed cross-PR/CI contamination by ignoring submodules during code format validation. #3033
    • Added support for writing benchmarks with google/benchmark. #2780
    • The PR/CI system now uses "1ES Hosted Pools". #3054
    • Updated dependencies. #2754 #2791 #2831 #2861 #3017
      • Updated build compiler to VS 2022 17.4 Preview 1 (now required).
      • Updated Clang to 14.0.5 (now required).
      • Updated CMake to 3.23 (now required).
      • Updated Ninja to 1.11.0.
      • Updated Python to 3.10.6.
      • Updated CUDA to 11.6.0 (now required).
  • Updated _MSVC_STL_UPDATE. #2764 #2840 #3020