Boost C++ Libraries: Ticket #6513: assignment vs comparison in unit test https://svn.boost.org/trac10/ticket/6513 <p> In file date_time\test\gregorian\testdate_input_facet.cpp is the following line: </p> <pre class="wiki"> check("No extra characters consumed", m = greg_month(Mar) &amp;&amp; *sitr == '.'); </pre><p> Compiling with VC8 gives a warning C4800: 'unsigned short' : forcing value to bool 'true' or 'false' (performance warning). I believe the problem is that m is being assigned to, so that the actual expression being given to check() or operator&amp;&amp; is m, which is converted to a boolean. I would also split the test into two lines, just for clarity: </p> <pre class="wiki"> check("Correct input", m == greg_month(Mar)); check("No extra characters consumed", *sitr == '.'); </pre><p> I found this bug in 1.48, but it is still present in the trunk, even though in the trunk the tests were converted from the ad-hoc test framework to Boost's general test framework. It might apply to other versions, too. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6513 Trac 1.4.3 Marshall Clow Wed, 26 Sep 2012 16:44:42 GMT <link>https://svn.boost.org/trac10/ticket/6513#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6513#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80709" title="Fix typo in test case; Refs #6513">[80709]</a>) Fix typo in test case; Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6513" title="#6513: Bugs: assignment vs comparison in unit test (closed: fixed)">#6513</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sun, 30 Sep 2012 23:25:27 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6513#comment:2 https://svn.boost.org/trac10/ticket/6513#comment:2 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80797" title="Merge bug fixes to release; Fixes #5550 Fixes #6136 Fixes #6513 Fixes ...">[80797]</a>) Merge bug fixes to release; Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5550" title="#5550: Bugs: Missing initializer warning in date_time/date_facet.hpp (closed: fixed)">#5550</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6136" title="#6136: Patches: Fix for &#34;variable set but not used&#34; warning with GCC &gt;= 4.6 (closed: fixed)">#6136</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6513" title="#6513: Bugs: assignment vs comparison in unit test (closed: fixed)">#6513</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7111" title="#7111: Feature Requests: Switch case's default missing in date_time (closed: fixed)">#7111</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7112" title="#7112: Feature Requests: Switch case default missing in date_time (closed: fixed)">#7112</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7113" title="#7113: Feature Requests: In date_time default case of switch is missing. (closed: fixed)">#7113</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7342" title="#7342: Bugs: Warning in format_date_parser.hpp (closed: fixed)">#7342</a> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7426" title="#7426: Patches: Warning fixes in datetime (closed: fixed)">#7426</a> </p> Ticket