MSVC conformance improvements in Visual Studio 2017 version 15.5
The MSVC toolset included in Visual Studio version 15.5 preview 4 includes many C++ conformance improvements. Throughout the VS2015 and VS2017 releases we’ve focused on conformance with C++ standards, including C++17 features. With VS2017 version 15.5, MSVC has implemented about 75% of C++17 core language and library features. These features can be enabled by using the /std:c++17 version switch.
- Notable completed features in the compiler include:
- Structured bindings with support in the VS debugger
- Inline variables
- Fold expressions
- Addition of
noexceptto the type system
- Notable changes to our implementation of the Standard Library include:
- Splicing Maps and Sets
- Removing Allocator Support in
- Inline Variables for the STL
- Removal of Dynamic Exception Specifications
- Deprecating Vestigial Library Parts
Note that some of these features were included in the 15.3 cycle and completed in the 15.5 cycle.
We’ve also made significant progress on fixing older conformance issues including expression SFINAE fixes,
constexpr completeness, and the majority of two-phase name lookup cases.
Lastly, with regards to current Technical Specifications, we’ve made syntax changes as requested by the C++ Standards Committee. The MSVC compiler in VS2017 version 15.5 implements the syntax change to module interfaces that were requested at the summer meeting.
You now add
export in the declaration of a module interface. For example, you write this
export module FileIO; export File OpenFile(const Path&);
to declare the module interface of
FileIO where you would have previously written
module FileIO; export File OpenFile(const Path&);
More complete information about C++ conformance improvements in MSVC can be found on docs.microsoft.com and in an upcoming blog post from Stephan T. Lavavej.
Conformance mode on-by-default for new projects.
We’ve enabled the
/permissive- conformance mode by default with new projects created in Visual C++, enabling you to write code that is much closer to C++ standards conformance. This mode disables non-conforming C++ constructs that have existed in MSVC for years. You can learn more about our conformance mode and the
/permissive- switch that controls it in this blog post or on docs.microsoft.com.
To enable Conformance mode in an older project (or disable it in a new project), just change the Project Properties > C/C++ > Language > Conformance mode setting:
If you’re building on a machine without Visual Studio installed and need to edit the
.vcxproj directly, you’ll find the setting is controlled by the ConformanceMode tag. Remember that this tag exists once for each platform configuration in your project. Here’s an example from a
[xml] <ItemDefinitionGroup Condition="’$(Configuration)|$(Platform)’==’Debug|Win32’"> <ClCompile> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <ConformanceMode>true</ConformanceMode> </ClCompile> </ItemDefinitionGroup> [/xml]
The conformance mode is compatible with almost all header files from the latest Windows Kits, starting with the Windows Fall Creators SDK (10.0.16299.0). Individual conformance features can be controlled by the finer-grained /Zc conformance switches.
MSVC toolset version number increases to 14.12
Because of the number of conformance improvements and bug fixes included in the MSVC toolset that ships with VS2017 version 15.5, we’re increasing the version number from 14.11 to 14.12. This minor version bump indicates that the VS2017 MSVC toolset is binary compatible with the VS2015 MSVC toolset, enabling an easier upgrade for VS2015 users.
VS2017 version 15.5 includes the third significant update to the MSVC toolset in VS2017. The first update released with VS2017 RTW. The second update came with update version 15.3. For reference, here are the MSVC toolset versions and compiler versions (_MSC_VER) in each release of VS2015 to VS2017. (Note that for historical reasons the MSVC compiler version is 5 higher than the MSVC toolset version displayed in Visual Studio.)
|Visual Studio Version||MSVC Toolset Version||MSVC compiler version (|
|VS2015 and updates 1, 2, & 3||v140 in VS; version 14.00||1900|
|VS2017, version 15.1 & 15.2||v141 in VS; version 14.10||1910|
|VS2017, version 15.3 & 15.4||v141 in VS; version 14.11||1911|
|VS2017, version 15.5||v141 in VS; version 14.12||1912|
Try out the MSVC compiler in Visual Studio version 15.5 Preview 4 and let us know what you think! As always, we can be reached via the comments below, via email (firstname.lastname@example.org) and you can provide feedback via Help > Report A Problem in the product, or via Developer Community. You can also find us on Twitter (@VisualC) and Facebook (msftvisualcpp).