VS 2022 17.4
StephanTLavavej
released this
09 Mar 05:26
·
973 commits
to main
since this release
- Merged C++23 features:
- P0849R8 #2808
auto(x)
:decay-copy
In The Language- The compiler part is not yet implemented; the library part was implemented in C++20 mode when Ranges were initially implemented.
- P0881R7 #2502
<stacktrace>
- P2301R1 Add A
pmr
Alias Forstd::stacktrace
- P2301R1 Add A
- P1206R7 #2806 #3026 #3028 Conversions From Ranges To Containers
- P1328R1 #2793
constexpr
type_info::operator==()
- P1899R3 #2981
views::stride
- P2291R3 #3049
constexpr
Integral<charconv>
- P2302R4 #2911
ranges::contains
,ranges::contains_subrange
- P2387R3 #2661 Pipe Support For User-Defined Range Adaptors
- P2408R5 #2960 #3056 Ranges Iterators As Inputs To Non-Ranges Algorithms
- P2417R2 #2972 More
constexpr
bitset
- P2419R2 #2977 Clarify Handling Of Encodings In Localized Formatting Of
chrono
Types - P2438R2 #3057
string::substr() &&
- P2440R1 #2580
ranges::iota
,ranges::shift_left
,ranges::shift_right
- P2441R2 #2619
views::join_with
- P2445R1 #2974
forward_like()
- P2446R2 #3008
views::as_rvalue
- P2494R2 #2965 Relaxing Range Adaptors To Allow Move-Only Types
- P2499R0 #2947
string_view
Range Constructor Should Beexplicit
- P2517R1 #2959 Conditional
noexcept
Forapply()
- P2520R0 #2958 #2994
move_iterator<T*>
Should Be A Random-Access Iterator
- P0849R8 #2808
- Merged LWG issue resolutions:
- LWG-3564 #2961
transform_view::
iterator
<true>::value_type
anditerator_category
should useconst F&
- LWG-3617 #2966
function
/packaged_task
deduction guides and deducingthis
- LWG-3656 #2880 Inconsistent bit operations returning a count
- LWG-3671 #2905
atomic_fetch_xor
missing fromstdatomic.h
- LWG-3672 #2907
common_iterator::operator->()
should return by value - LWG-3683 #2879
operator==
forpolymorphic_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
ofchunk_view
for input ranges can beconst
- LWG-3712 #2943
chunk_view
andslide_view
should not bedefault_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
- LWG-3564 #2961
- Merged proposed resolutions for LWG issues (not yet accepted for the C++ Working Draft, but we've chosen to implement this speculatively):
- 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
orunsigned long
values withformatter
. #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") foryear_month_day
,year_month_day_last
,year_month_weekday
, andyear_month_weekday_last
. #2762std::filesystem::directory_entry
's constructors,assign()
, andreplace_filename()
now callrefresh()
as required by the Standard and will propagate any errors (via exceptions orerror_code
s), 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_point
s. #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()
andallocate_shared()
. #2811 put_time()
(and thetime_put::do_put()
machinery powering it) now avoids modifyingerrno
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 printduration
s with extremely small periods (e.g. femtoseconds, attoseconds). #2814 - Fixed "
istreambuf_iterator
is not dereferenceable" assertions when attempting to usetime_get::get()
orget_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 setsios_base::failbit | ios_base::eofbit
as required by the Standard.
- For example, with the format
- 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()
andfilesystem::copy()
to handle junctions. #2877 - Fixed compiler errors in
ranges::uninitialized_copy_n
andranges::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
andranges::sample
to acceptuniform_random_bit_generator
s that don't provideresult_type
. #3002 - Fixed
vector<bool>::insert(where, first, last)
andvector<bool>::insert_range(where, range)
to meet the Standard's complexity requirements. #3021 - Fixed how
chunk_view
andstride_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
dllexport
ing classes derived frompair
ortuple
. #3045 - Fixed
<regex>
integer overflows when parsing huge numbers in backreferences, braced repetitions, and decimal escapes. #2169- These will now properly throw
regex_error
s with codes oferror_backref
,error_badbrace
, anderror_escape
, respectively.
- These will now properly throw
- 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 amemcpy
workaround. #3066
- Fixed linker errors when using
- Improved performance:
- Improved
clamp()
codegen with conditional move instructions. #2336 - Massively improved iostreams performance for
signed char
,unsigned char
,char8_t
, andbyte
elements, matching the performance ofchar
by avoiding a slow codepath. #2739 vector
's range constructor,insert()
, andassign()
now efficiently handle iterators that satisfy theforward_iterator
concept, even when their classiciterator_category
isn't convertible toforward_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()
, andranges::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()
andexperimental::filesystem::resize_file()
. #2771 - Improved the optimized codegen for
T + complex<T>
,T * complex<T>
,complex<T> * T
, andcomplex<T> / T
. Improved the debug codegen forcomplex<T> + T
andcomplex<T> - T
. #2855 - Improved the optimized codegen for
unreachable()
. #3055
- Improved
- Improved throughput:
- Used
if constexpr
instead of tag dispatch in:get<I>()
andget<T>()
forpair
. #2756
optional
,pair
, andtuple
now use conditionalexplicit
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 implementboyer_moore_searcher
. - Escape hatch: define
_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
. #3027
- This also improves throughput for
<functional>
now avoids including<memory>
. #2998- Escape hatch: define
_LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY
. #3027
- Escape hatch: define
- Used
- 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 forunsigned short
that are intended for fakewchar_t
only (i.e. the non-Standard/Zc:wchar_t-
option). #2164 - The STL now marks all of its namespace-scope
constexpr
variables asinline
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".
- 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
constexpr
basic_string
now uses the Small String Optimization. #1735error_code
s with0
values andfuture_category
oriostream_category
now return"success"
frommessage()
, matching the behavior ofgeneric_category
. #2742<system_error>
now maps: #2744 #2899WAIT_TIMEOUT
,ERROR_TIMEOUT
, andERROR_SEM_TIMEOUT
toerrc::timed_out
ERROR_BAD_NET_NAME
toerrc::no_such_file_or_directory
ERROR_FILENAME_EXCED_RANGE
toerrc::filename_too_long
- Added visualizers for
unique_ptr
s andvector
s storing character sequences. #2843 - Added more visualizers for
<any>
,<format>
,<functional>
,<mutex>
, and<ranges>
. #2191 <cstdlib>
now makes itsusing
-declarations forstd::getenv()
andstd::system()
available to UWP apps. #2850<filesystem>
and<experimental/filesystem>
now useGetTempPath2W()
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
."
- STL4038 warns "The contents of
<unordered_map>
and<unordered_set>
no longer provide a non-Standardhash_compare
class template innamespace 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++20std::erase_if()
instead.
- For example, discarding the return value of
vector::assign(num, val)
andstd::swap_ranges()
now have debug checks for forbidden aliasing. #1263- Strengthened exception specifications on:
- 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
- Enabled tests now that Clang 14 supports
- 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 toerrc
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>
'sstatic constexpr
data members. #3006 - Finished changing all aliases from
typedef
tousing
. #3018 - Cleaned up several tests to avoid unnecessary dependencies on macros and non-Standard code. #3034
- Updated
<functional>
and<memory>
to consistently use modernint = 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 templatedstatic constexpr
data members as internal helpers. #2980
- Added a comment explaining why
- 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