Boost logo

Boost :

Subject: [boost] [typeof][scope_exit] VS2017 and option /permissive-
From: Daniela Engert (dani_at_[hidden])
Date: 2017-04-15 09:25:36


Hello,

late last year, VS2017RC gained a compiler option /permissive- which
disables some non-conforming behaviour. Source code that was accepted by
previous versions of msvc, and still is accepted by msvc 14.1 without
this compiler option, is rejected and flagged as an error if
/permissive- is engaged. For more on this see
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.

While checking our company's codebase for possible problems related to
that I noticed compile errors in Boost.Log and traced the problem back
to Boost.Typeof and in particular
"libs\typeof\include\boost\typeof\msvc\typeof_impl.hpp". Therein is code
emulating the missing __typeof__ keyword by taking advantage of a silent
msvc compiler 'bug' as a 'feature'. Parts of this code are duplicated in
a msvc-specific workaround in Boost.Scope_Exit. This compiler bug is no
longer silent with /permissive- in place but rather a hard error. As it
turns out, I'm not the first to be bitten by this: ticket #12900 tells
the same story.

Many other Boost libraries use Boost.Typeof directly or indirectly and
therefore suffer from the same problem (like Boost.Log in my particular
case).

I've implemented a possible solution and created two pull-requests:
- https://github.com/boostorg/typeof/pull/7
- https://github.com/boostorg/scope_exit/pull/3

The patches only affect msvc 14.1. With these patches applied, the test
results of the full Boost testsuite are the same as without these
patches. I don't know enough about __typeof__ to decide if my emulation
is compatible in every aspect, but at least it's good enough to pass the
testsuite.

There are two other compile failures introduced with /permissive- in
place which are compiler bugs which need to be addressed by Microsoft's
compiler team. Fortunately these are very specific to just two
libraries, Boost.Spirit.Repository (one test case) and Boost.Geometry
(two test cases caused by one single function).

-- 
PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk