Boost C++ Libraries: Ticket #10793: Compilation errors in Visual Studio 2013 with /Za (disabled extensions) https://svn.boost.org/trac10/ticket/10793 <p> Use of Scope Exit generates compilation errors in Visual Studio 2013 (version 18.00.31101 for x86) if <code>/Za</code> option (disabled language extensions) is used. </p> <p> I haven't checked other VS versions. I haven't checked previous Boost versions. And <code>/Za</code> is not set by default (language extensions are enabled by default). </p> <p> With <code>BOOST_SCOPE_EXIT_ALL</code> we get following errors: </p> <pre class="wiki">C:\Users\Adam Badura\Dropbox\Projekty\scope_exit&gt;cl /EHsc /Za /I"C:\Programming\boost_1_57_0" BOOST_SCOPE_EXIT_ALL.cpp Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved. BOOST_SCOPE_EXIT_ALL.cpp C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2143: syntax error : missing ';' before '&lt;' C:\Programming\boost_1_57_0\boost/scope_exit.hpp(427) : see reference to class template instantiation 'boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type&lt;ID,T&gt;' being compiled C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2913: explicit specialization; 'boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type&lt;ID,boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type_default_param&gt;::id2type_impl' is not a specialization of a class template C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2059: syntax error : '&lt;' C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body </pre><p> With <code>BOOST_SCOPE_EXIT</code> we get following errors: </p> <pre class="wiki">C:\Users\Adam Badura\Dropbox\Projekty\scope_exit&gt;cl /EHsc /Za /I"C:\Programming\boost_1_57_0" BOOST_SCOPE_EXIT.cpp Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved. BOOST_SCOPE_EXIT.cpp C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2143: syntax error : missing ';' before '&lt;' C:\Programming\boost_1_57_0\boost/scope_exit.hpp(427) : see reference to class template instantiation 'boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type&lt;ID,T&gt;' being compiled C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2913: explicit specialization; 'boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type&lt;ID,boost::scope_exit::aux::msvc_typeof_this::msvc_extract_type_default_param&gt;::id2type_impl' is not a specialization of a class template C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2059: syntax error : '&lt;' C:\Programming\boost_1_57_0\boost/scope_exit.hpp(419) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body BOOST_SCOPE_EXIT.cpp(9) : warning C4003: not enough actual parameters for macro 'BOOST_PP_EXPAND_I' </pre><p> Note that in case of <code>BOOST_SCOPE_EXIT</code> we also get warning C4003. And it shows in clean build (without <code>/Za</code>) as well. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10793 Trac 1.4.3 adam.f.badura@… Fri, 14 Nov 2014 20:49:37 GMT attachment set https://svn.boost.org/trac10/ticket/10793 https://svn.boost.org/trac10/ticket/10793 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">BOOST_SCOPE_EXIT_ALL.cpp</span> </li> </ul> <p> Demonstration program for BOOST_SCOPE_EXIT_ALL </p> Ticket adam.f.badura@… Fri, 14 Nov 2014 20:50:05 GMT attachment set https://svn.boost.org/trac10/ticket/10793 https://svn.boost.org/trac10/ticket/10793 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">BOOST_SCOPE_EXIT.cpp</span> </li> </ul> <p> Demonstration program for BOOST_SCOPE_EXIT </p> Ticket Michel Morin Sat, 15 Nov 2014 02:02:02 GMT <link>https://svn.boost.org/trac10/ticket/10793#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10793#comment:1</guid> <description> <p> As for the <code>/Za</code> compiler option, </p> <blockquote> <p> <strong>don't use <code>/Za</code>.</strong> </p> </blockquote> <p> The <code>/Za</code> option is buggy and its use is not recommended (or rather, you shouldn't use it). See the posts from Stephan T. Lavavej (Visual C++ libraries developer) such as <a class="ext-link" href="http://thread.gmane.org/gmane.comp.compilers.clang.devel/21638/focus=21638"><span class="icon">​</span>this</a>. </p> </description> <category>Ticket</category> </item> <item> <author>adam.f.badura@…</author> <pubDate>Sat, 15 Nov 2014 02:36:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10793#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10793#comment:2</guid> <description> <p> I wasn't aware of that. Good to know! Then the ticket may be closed (rejected or whatever you do) I think. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jürgen Hunold</dc:creator> <pubDate>Sun, 16 Nov 2014 08:15:18 GMT</pubDate> <title>status, severity changed; resolution set https://svn.boost.org/trac10/ticket/10793#comment:3 https://svn.boost.org/trac10/ticket/10793#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Not Applicable</span> </li> </ul> <p> Closed as /Za is broken as mentioned in earlier comments. </p> Ticket Scott Colcord <sacolcor@…> Tue, 24 Oct 2017 19:55:12 GMT status, version, severity changed; resolution deleted https://svn.boost.org/trac10/ticket/10793#comment:4 https://svn.boost.org/trac10/ticket/10793#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.57.0</span> → <span class="trac-field-new">Boost 1.65.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">invalid</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Not Applicable</span> → <span class="trac-field-new">Problem</span> </li> </ul> <p> I'm reopening this issue, because the problem also occurs with the new /permissive- option. This is the new and better VC standards compliance mode, and is intended to become the default mode for the compiler in the future. </p> Ticket Scott Colcord <sacolcor@…> Wed, 01 Nov 2017 00:57:06 GMT <link>https://svn.boost.org/trac10/ticket/10793#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10793#comment:5</guid> <description> <p> It looks like it can be fixed by changing <code>scope_exit.hpp</code> thusly: </p> <pre class="wiki">#if BOOST_MSVC # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 1 #else # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 0 #endif </pre><p> to: </p> <pre class="wiki">#if BOOST_WORKAROUND(_MSC_VER, &lt; 1910) # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 1 #else # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 0 #endif </pre> </description> <category>Ticket</category> </item> <item> <author>Scott Colcord <sacolcor@…></author> <pubDate>Wed, 01 Nov 2017 01:03:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10793#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10793#comment:6</guid> <description> <p> ...or possibly : </p> <pre class="wiki">#if BOOST_WORKAROUND(BOOST_MSVC, &lt; 1910) # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 1 #else # define BOOST_SCOPE_EXIT_AUX_TYPEOF_THIS_MSVC_WORKAROUND_01 0 #endif </pre> </description> <category>Ticket</category> </item> </channel> </rss>