[xpressive] Significant compiler warning

I have a program that uses Boost.Xpressive. When compiling this code on the Macintosh with the darwin-4.2.1 toolset, I get the following compiler warning: .../boost_1_41_0/boost/xpressive/traits/cpp_regex_traits.hpp:84: warning: left shift count >= width of type Here is the offending line of code: umaskex_t const highest_bit = 1 << (sizeof(umaskex_t) * CHAR_BIT - 1); The problem (if my thinking cap is screwed on correctly) is that the 1 that is being shifted is of type int, and is not converted to the target type of umaskex_t until after the shift operation. I believe that this should be changed to the following to avoid highest_bit being set to zero: umaskex_t const highest_bit = static_cast<umaskex_t>(1) << (sizeof(umaskex_t) * CHAR_BIT - 1);

Ian Emmons wrote:
Seems right to me. I'll make the change. Thanks. -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Ian Emmons