C++14/17 Features and STL Fixes in VS “15” Preview 4

Visual Studio “15” Preview 4 is now available, with a new installer.  (VS “15” is an IDE version number, not a year.  It’s the next major version after VS 2015, which was IDE version 14.  VS has different numbers for its year branding, IDE version, and C++ compiler version.)


All of the features and fixes in VS 2015 Update 3 (including optimizer improvements for std::abs(), std::min(), std::max(), and std::pow(), which we forgot to mention) are also available in VS “15” Preview 4.  Additionally, we have something new to announce.  Previously, new major IDE versions contained new major compiler versions and binary-incompatible STLs (which allowed us to overhaul our data structure representations for correctness and performance).  Now that we’ve been adding features to the compiler and STL since VS 2015 RTM in a highly compatible manner, we’re going to continue this into the new major IDE version.  Specifically, VS 2015 and VS “15” will have the same major compiler version (19) and their STLs will be binary-compatible, and this compatible compiler and STL will remain available throughout the lifecycle of VS “15”.  This implies that the STL’s DLL will continue to be named msvcp140.dll.  (At some point in the future, we expect to have a compiler version 20 and a binary-incompatible STL again.)


Note that we’re guaranteeing binary compatibility, not source compatibility.  While the version switch /std:c++14 (which is the default) will typically preserve source compatibility, it is always possible for bugfixes or Issue resolutions to require source code changes.  While we’re trying to avoid unnecessary source breaking changes, when they’re necessary they’ll be documented on MSDN, as we’ve been doing for VS 2015 Updates.  And note that /std:c++latest will frequently experience source breaking changes, but we’ll try to document them too (especially in the STL, as we update our implementation to conform to the latest Working Paper, this can sometimes break source code in unexpected ways which we aren’t immediately aware of, hence the caveat).


To be clear, this is a good thing for you, our programmer-users.  Although the major compiler version is remaining unchanged at 19, we’re still adding new compiler and STL features.  (_MSC_FULL_VER will increase, allowing the updated compiler to be detected.)  And the STL binary compatibility means that third-party libraries can be built once and used with both VS 2015 and VS “15”.  (However, it is still best for everything to be compiled consistently with the latest available version, as that will give you the most correctness and performance.)  Now, here’s what we’re adding:


Compiler Features


The C++14 feature NSDMIs for aggregates has been implemented unconditionally by Vinny Romano.


The C++17 feature [[fallthrough]] attribute has been implemented under /std:c++latest by Shuo Chang.


STL Features


The C++17 feature <algorithm> sample() has been implemented under /std:c++latest.


The C++17 feature is_callable has been implemented under /std:c++latest.  (is_nothrow_callable was blocked by a compiler bug in Preview 4, which has been fixed for the next build.)


LWG Issues


The following C++14 Library Issue resolutions have been implemented unconditionally:


  • LWG 2135 Unclear requirement for exceptions thrown in condition_variable::wait()
  • LWG 2203 scoped_allocator_adaptor uses wrong argument types for piecewise construction
  • LWG 2210 Missing allocator-extended constructor for allocator-aware containers


The following C++17 Library Issue resolutions have been implemented unconditionally:


  • LWG 2063 Contradictory requirements for string move assignment
  • LWG 2219 INVOKE-ing a pointer to member with a reference_wrapper as the object expression
  • LWG 2439 unique_copy() sometimes can’t fall back to reading its output
  • LWG 2476 scoped_allocator_adaptor is not assignable
  • LWG 2566 Requirements on the first template parameter of container adaptors
  • LWG 2576 istream_iterator and ostream_iterator should use std::addressof
  • LWG 2577 {shared,unique}_lock should use std::addressof
  • LWG 2579 Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assign
  • LWG 2583 There is no way to supply an allocator for basic_string(str, pos)
  • LWG 2586 Wrong value category used in scoped_allocator_adaptor::construct()
  • LWG 2684 priority_queue lacking comparator typedef
  • LWG 2716 Specification of shuffle and sample disallows lvalue URNGs


STL Fixes


Cleaned up _ITERATOR_DEBUG_LEVEL=2 assertions.  Now they always emit only one assertion dialog, and they cannot be ignored.  (Previously, some but not all assertions emitted two dialogs, and some but not all could be ignored.)


Further improved support for fancy pointers.  Class types imitating pointers while wearing top hats and monocles are now accepted throughout more of the STL.  (Fancy pointers, powered by std::pointer_traits, are highly advanced and extremely rare.)


Fixed a regression that was triggering compiler errors when calling uninitialized_copy() on a list/forward_list containing elements with non-trivial destructors (VSO#233820/Connect#2846868).


Fixed all known scoped_allocator bugs: VSO#129349 “<scoped_allocator>: scoped_allocator is attempting to default construct allocators”, VSO#146338 “<scoped_allocator>: error C2512: no appropriate default constructor available”, and VSO#224478 “<scoped_allocator>: construction is using true placement new, not OUTERMOST_ALLOC_TRAITS::construct”.


Fixed setlocale() memory corruption issues in <filesystem>.


Fixed broken handling of match_prev_avail, match_not_bol, and match_not_eol in <regex> (VSO#225160/Connect#2745913, VSO#226914).


Prevented the CRT from shutting down before std::async() threads have shut down (VSO#225699).


Billy Robert O’Neal III – @MalwareMinigunbion@microsoft.com

Casey Carter – @CoderCaseycacarter@microsoft.com

Stephan T. Lavavej – @StephanTLavavejstl@microsoft.com

Steve Wishnousky – stwish@microsoft.com