Boost C++ Libraries: Ticket #4669: Lots of warnings from is_unsigned.hpp https://svn.boost.org/trac10/ticket/4669 <p> When compiling programs that in some way use is_unsigned_imp, warnings from boost obscure the warnings that I'm interested in (i.e. the ones that I have caused myself). The same problem exists with is_signed_imp. </p> <p> <strong>Environment Info:</strong><br /> FreeBSD 8.1 sparc64 <br /> gcc version 4.2.1 20070719 [FreeBSD]<br /> </p> <p> <strong>Minimal test program</strong>:<br /> </p> <p> #include&lt;boost/type_traits/is_unsigned.hpp&gt; </p> <p> int isUnsigned() { </p> <blockquote> <p> return boost::detail::is_unsigned_imp&lt;unsigned int&gt;::value; </p> </blockquote> <p> } </p> <p> <strong>Result</strong>: g++ -I/usr/local/include testa.c -c </p> <p> /usr/local/include/boost/type_traits/is_unsigned.hpp: In instantiation of 'boost::detail::is_ununsigned_helper&lt;unsigned int&gt;': /usr/local/include/boost/type_traits/is_unsigned.hpp:73: instantiated from 'boost::detail::is_unsigned_imp&lt;unsigned int&gt;' testa.c:5: instantiated from here /usr/local/include/boost/type_traits/is_unsigned.hpp:40: warning: comparison between 'enum boost::detail::is_unsigned_values&lt;unsigned int&gt;::&lt;anonymous&gt;' and 'enum boost::detail::is_unsigned_values&lt;unsigned int&gt;::&lt;anonymous&gt;' </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4669 Trac 1.4.3 Per Ola Ingvarsson <skrabban@…> Tue, 21 Sep 2010 20:36:47 GMT <link>https://svn.boost.org/trac10/ticket/4669#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4669#comment:1</guid> <description> <p> Using gcc-4.2.1, is_unsigned_values (via the macro BOOST_STATIC_CONSTANT) becomes: </p> <p> template &lt;class T&gt;<br /> struct is_unsigned_values<br /> {<br /> </p> <blockquote> <p> typedef typename remove_cv&lt;T&gt;::type no_cv_t;<br /> enum { minus_one = (static_cast&lt;no_cv_t&gt;(-1)) };<br /> enum { zero = (static_cast&lt;no_cv_t&gt;(0)) };<br /> </p> </blockquote> <p> }; </p> <p> Using gcc-4.4.5 (debian), it expands to. </p> <p> template &lt;class T&gt;<br /> struct is_unsigned_values<br /> {<br /> </p> <blockquote> <p> typedef typename remove_cv&lt;T&gt;::type no_cv_t;<br /> static const no_cv_t minus_one = (static_cast&lt;no_cv_t&gt;(-1));<br /> static const no_cv_t zero = (static_cast&lt;no_cv_t&gt;(0)); </p> </blockquote> <p> }; </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 22 Sep 2010 08:45:43 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4669#comment:2 https://svn.boost.org/trac10/ticket/4669#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">worksforme</span> </li> </ul> <p> I'm unable to reproduce this here: Boost.Config <em>never</em> sets BOOST_NO_INCLASS_MEMBER_INITIALIZATION for any gcc compiler version (which is what would cause BOOST_STATIC_CONSTANT to use enum's rather than a true static constant). </p> <p> In addition all the type_traits are currently run with -Wall -pedantic -Werror and all the tests are passing even on the BSD platforms that are tested: <a class="ext-link" href="http://beta.boost.org/development/tests/trunk/developer/type_traits.html"><span class="icon">​</span>http://beta.boost.org/development/tests/trunk/developer/type_traits.html</a> </p> <p> However, some testing reveals that using an enum in this context causes is_unsigned to malfunction anyway, so I'll change the code to always use a static constant. </p> <p> I'd be interested in knowing why BOOST_NO_INCLASS_MEMBER_INITIALIZATION is being set on this platform/compiler combination - are you using a modified Boost version at all? </p> Ticket John Maddock Wed, 22 Sep 2010 08:48:02 GMT <link>https://svn.boost.org/trac10/ticket/4669#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4669#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/65531" title="Change these two traits to always use a static constant and not ...">[65531]</a>) Change these two traits to always use a static constant and not BOOST_STATIC_CONSTANT - otherwise they don't work! Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4669" title="#4669: Bugs: Lots of warnings from is_unsigned.hpp (closed: worksforme)">#4669</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Per Ola Ingvarsson <pi@…></author> <pubDate>Wed, 22 Sep 2010 14:40:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4669#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4669#comment:4</guid> <description> <p> Non-standard it is. Found out that it is the FreeBSD port that adds the following: </p> <pre class="wiki">// // gcc previous to 4.3.x does not implement inclass member initialization // #if (__GNUC__ &lt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &lt;= 2)) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION #endif </pre><p> Which is not exactly true, more likely it is a workaround for the problem described in <a class="new ticket" href="https://svn.boost.org/trac10/ticket/4381" title="#4381: Bugs: GCC previous to 4.3.x does not implement inclass member initialization (new)">#4381</a>. </p> </description> <category>Ticket</category> </item> </channel> </rss>