The problem can be reproduced even more simply:<div><br></div><div>BOOST_STATIC_WARNING(false);</div><div><br></div><div>does not produce a warning on my machine.</div><div><br></div><div>If I make my own (not as versatile) version, which mimics the way Boost actually does it without all the MPL stuff, it works:</div>
<div><br></div><div><div>namespace detail</div><div>{</div><div>� � template &lt;typename TIntegralContant&gt;</div><div>� � inline void test_warning(const TIntegralContant&amp;)</div><div>� � {</div><div>� � � � static_cast&lt;void&gt;(1 / TIntegralContant::value);</div>
<div>� � }</div><div>}</div><div><br></div><div>#define MY_STATIC_WARNING(value_) \</div><div>� � ::detail::test_warning(::boost::integral_constant&lt;bool, value_ &gt;())</div><div><br></div><div>So it isn&#39;t that g++ won&#39;t emit a warning for that error, it just seems to get lost somewhere.</div>
<br><div class="gmail_quote">On Wed, May 25, 2011 at 1:16 PM, Ovanes Markarian <span dir="ltr">&lt;<a href="mailto:om_boost@keywallet.com">om_boost@keywallet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Wed, May 25, 2011 at 7:09 PM, Travis Gockel <span dir="ltr">&lt;<a href="mailto:travis@gockelhut.com" target="_blank">travis@gockelhut.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><div>I&#39;ve recently had some trouble with C++&#39;s implicit casting, so�I&#39;m looking for a way to warn people if somebody attempts to assign an int32_t to a uint64_t or whatever. �BOOST_STATIC_ASSERT would work wonders for this, except that the code base I&#39;m working with is quite large and relies on a lot of implicit casting, so immediately breaking everything with assertions is unrealistic.</div>



<div><br></div><div>It looks like BOOST_STATIC_WARNING (<a href="http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/static_warning.html" style="color:rgb(17, 65, 112)" target="_blank">http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/static_warning.html</a>) would be ideal for me, however, I cannot get it to actually emit a warning. �I have attached a quick example of what I am looking for, but it essentially boils down to this not doing anything:</div>



<div><br></div><div><div>� � � � typedef boost::is_same&lt;int64_t, int32_t&gt; same_type;</div><div>� � � � BOOST_STATIC_WARNING(same_type::value);</div></div><div><br></div><div>My compiler is g++ 4.4.3 with --std=c++0x -Wall -Wextra.</div>



<div><br></div><div>Thanks!</div></span></blockquote><div><br></div></div></div><div>Hello Travis,</div><div><br></div><div>unfortunately I have no boost 1.46 by the hand, but as far as I understand int64_t and int32_t are different type and should not result in value equals true. What happens if you produce non-convertible types like:</div>


<div><br></div><div>template&lt;class T&gt; identity{}; //you can also use mpl::identity</div><div><br></div><div>typedef boost::is_same&lt;identity&lt;int64_t&gt;, identity&lt;int32_t&gt; &gt; same_type;</div><div class="im">
<div><br></div>

<div>BOOST_STATIC_WARNING(same_type::value);</div><div><br></div><div><br></div></div><div>With Kind Regards,</div><div>Ovanes</div><div><br></div><div><br></div><div><br></div><div>�</div></div>
<br>_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>- Travis Gockel<br>
</div>