Boost C++ Libraries: Ticket #9100: has_*_operator.hpp generates C6334 using VC++ https://svn.boost.org/trac10/ticket/9100 <p> Warning 2 warning C6334: sizeof operator applied to an expression with an operator might yield unexpected results: Parentheses can be used to disambiguate certain usages. c:\users\ian\dev\tensor\main\code\external\boost\latest\boost\type_traits\detail\has_binary_operator.hpp </p> <p> This can be fixed by adding an extra set of parentheses around returns_void( ... ). For example: sizeof((returns_void(...)) </p> <p> For example: has_binary_operator.hpp:95 Was: </p> <blockquote> <p> BOOST_STATIC_CONSTANT( bool, value = (sizeof(::boost::type_traits::yes_type) == sizeof( returns_void( (make&lt;Lhs&gt;() BOOST_TT_TRAIT_OP make&lt;Rhs&gt;(), returns_void_t()) ))) ); </p> </blockquote> <p> With fix: </p> <blockquote> <p> BOOST_STATIC_CONSTANT( bool, value = (sizeof(::boost::type_traits::yes_type) == sizeof((returns_void( (make&lt;Lhs&gt;() BOOST_TT_TRAIT_OP make&lt;Rhs&gt;(), returns_void_t()) )))) ); </p> </blockquote> <p> I was able to fix has_binary_operator.hpp and has_prefix_operator.hpp this way. I'm sure other metafunctions are affected as well. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9100 Trac 1.4.3 John Maddock Sun, 20 Apr 2014 16:44:02 GMT <link>https://svn.boost.org/trac10/ticket/9100#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9100#comment:1</guid> <description> <p> Apologies for taking such a long time to get to this... but do you have a test case? </p> <p> We compile our tests with -W4 _Werror and they don't show this warning. </p> <p> Many thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 15 Aug 2014 15:45:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9100#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9100#comment:2</guid> <description> <p> C6334 is a code analyser warning rather than a regular compiler warning, so you need a version of the compiler that supports the analyser to get it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 15 Aug 2014 17:45:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9100#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9100#comment:3</guid> <description> <p> Understood, can you submit either a patch or a pull request - as I can't reproduce here it is probably safer if you check the proposed fix works? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 28 May 2015 18:08:37 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9100#comment:4 https://svn.boost.org/trac10/ticket/9100#comment:4 <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">fixed</span> </li> </ul> <p> Finally fixed in <a class="ext-link" href="https://github.com/boostorg/type_traits/commit/e31d0ab7bdddd08b39342afbf9be3d4ade21d8cf"><span class="icon">​</span>https://github.com/boostorg/type_traits/commit/e31d0ab7bdddd08b39342afbf9be3d4ade21d8cf</a> (develop only) </p> Ticket