<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Nov 13, 2013, at 11:47 , Edward Diener <<a href="mailto:eldlistmailingz@tropicsoft.com">eldlistmailingz@tropicsoft.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On 11/13/2013 9:46 AM, Edward Diener wrote:<br><blockquote type="cite">I am seeing this error when testing Boost MPL with clang using the VC++<br>RTL:<br><br>"bitwise.cpp(40,25) : error: non-type template argument evaluates to<br>4294967295, which cannot be narrowed to type 'long' [-Wc++11-narrowing]<br>MPL_ASSERT_RELATION( (bitor_<_0,_ffffffff>::value), ==, 0xffffffff );"<br><br>The typedefs are:<br><br>typedef integral_c<unsigned int, 0> _0;<br>typedef integral_c<unsigned int, 0xffffffff> _ffffffff;<br><br>The bitor_ in the Boost MPL is evaluating constants at compile time,<br>doing a bitwise or ('|').<br><br>Why does clang think that 0xffffffff is a 'long' when used in the<br>comparison ? According to the C++ standard the type of 0xffffffff is the<br>first of int, unsigned int, long, unsigned long, long long, unsigned<br>long long in which its value can fit ( section 2.14.2 ). Is this a clang<br>bug ?<br></blockquote><br>Sorry, the problem is not as I had assumed above. It is actually because the MPL_ASSERT_RELATION macro devolves down to a template class where the values are of type 'long'. Is there something in C++11 which says that implicit conversion of a value from an 'unsigned int' to a 'long' is illegal ? That is what clang is telling me but I can find no such restriction in the C++11 standard regarding this.<br></div></blockquote></div><br><div>I think it’s more likely that on Windows ‘long’ is the same size as ‘int’, and so you have an overflow error. You need to fix the template…which I guess means submitting a patch to Boost.</div><div><br></div><div>If you’re just looking for a quick workaround, though, the presence of “-Wc++11-narrowing” in the error message is a hint: you can demote this no a warning using -Wno-error=c++11-narrowing.</div><div><br></div><div>Jordan</div></body></html>