microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
https://walbourn.github.io/directxtk/
MIT License
2.57k stars 511 forks source link

VS2017 solution not compatible with /permissive- with 15.3 update #103

Closed nasenbaer43 closed 7 years ago

nasenbaer43 commented 7 years ago

Hi Chuck, DirectXTK won't compile with VS 2017 15.3 and WinSDK 10.0.15063.0. I'm also on Win7 SP1 in case it is needed. Saw that you already fiddled with the /permissive flag in the past...

Here is a part of the actual compiler error: 1>c:\program files (x86)\windows kits\10\include\10.0.15063.0\winrt\wrl\client.h(892): error C2187: syntax error: 'identifier' was unexpected here 1>c:\program files (x86)\windows kits\10\include\10.0.15063.0\winrt\wrl\client.h(900): error C2187: syntax error: 'identifier' was unexpected here 1>c:\program files (x86)\windows kits\10\include\10.0.15063.0\winrt\wrl\implements.h(629): error C2187: syntax error: ')' was unexpected here ....

walbourn commented 7 years ago

I've got these fixes in the master branch for the next release, so you can pick them up there...

ruslangaripov commented 7 years ago

Two-phase name lookup support comes to MSVC:

If you are using the Windows RedStone2 (“Creators Update”) SDK with the /permissive- switch, you’ll need to temporarily disable two-phase name lookup by using the /Zc:twoPhase- switch until the Windows RedStone 3 (“Fall Creators Update”) SDK is available. This is because the Windows team has been working with the MSVC team to make the SDK headers work properly with two-phase name lookup. Their changes will not be available until the RedStone3 Windows SDK is released, nor will the changes for two-phase name lookup be ported back to the RedStone2 Windows SDK.

There's nothing good MSFT can make, I believe. -permissive- switch can even cause ICE, which was firstly detected on Windows SDK headers.

walbourn commented 7 years ago

There's always been a scheduling/coordination challenge between the MSVC compiler team and the Windows SDK. It's certainly gotten better in the past few years than it had been, but both teams are also making a lot of changes more quickly than ever before. The fact that the next Windows 10 SDK will have better support for /permissive- with two-phase is all goodness.

The fact that it generates an ICE in some cases is not actually that surprising. The MSVC team relies heavily upon a large sample suite of code to validate their compiler--including the DirectXMath test suite for example--, but because of the Windows SDK header limitations it can't use /permissive- extensively just yet. This is also why it's off by default right now too.

I make use of /permissive- in DirectXTK and my other libraries to try to improve the portability of the code. I've even tried building it with clang to flush out further issues. This does mean I'm more exposed to the areas of the MSVC compiler that are in flux, which is what happened here. I've applied fixes to the vcxproj which basically enables /Zc:twoPhase- in the master branch until the new Fall Creators Update SDK is available.

I'll take it as an action item to snap off a new release of DirectXTK, DirectXTK12, DirectXTex, DirectXMesh, and UVAtlas with these 15.3 updates ASAP.