Opened 11 years ago
#6297 new Feature Requests
Warning under VC
Reported by: | Antony Polukhin | Owned by: | Douglas Gregor |
---|---|---|---|
Milestone: | To Be Determined | Component: | numeric |
Version: | Boost 1.48.0 | Severity: | Cosmetic |
Keywords: | Cc: | antoshkka@… |
Description
Warning text:
c:\test\boost\boost\numeric\conversion\detail\converter.hpp(166) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
c:\test\boost\boost\numeric\conversion\detail\converter.hpp(165) : while compiling class template member function 'boost::numeric::range_check_result boost::numeric::convdetail::GT_HiT<Traits>::apply(bool)' with [
Traits=conv_traits
] c:\test\boost\boost\numeric\conversion\detail\converter.hpp(236) : see reference to class template instantiation 'boost::numeric::convdetail::GT_HiT<Traits>' being compiled with [
Traits=conv_traits
] c:\test\boost\boost\numeric\conversion\detail\converter.hpp(288) : see reference to class template instantiation 'boost::numeric::convdetail::combine<PredA,PredB>' being compiled with [
PredA=boost::numeric::convdetail::non_applicable, PredB=boost::numeric::convdetail::GT_HiT<conv_traits>
] c:\test\boost\boost\numeric\conversion\detail\converter.hpp(287) : while compiling class template member function 'boost::numeric::range_check_result boost::numeric::convdetail::generic_range_checker<Traits,IsNegOverflow,IsPosOverflow,OverflowHandler>::out_of_range(bool)' with [
Traits=conv_traits, IsNegOverflow=boost::numeric::convdetail::non_applicable, IsPosOverflow=boost::numeric::convdetail::GT_HiT<conv_traits>, OverflowHandler=boost::numeric::numeric_cast_traits<int,bool>::overflow_policy
] c:\test\boost\boost\numeric\conversion\detail\converter.hpp(508) : see reference to class template instantiation 'boost::numeric::convdetail::generic_range_checker<Traits,IsNegOverflow,IsPosOverflow,OverflowHandler>' being compiled with [
Traits=conv_traits, IsNegOverflow=boost::numeric::convdetail::non_applicable, IsPosOverflow=boost::numeric::convdetail::GT_HiT<conv_traits>, OverflowHandler=boost::numeric::numeric_cast_traits<int,bool>::overflow_policy
] c:\test\boost\boost\numeric\conversion\converter.hpp(35) : see reference to class template instantiation 'boost::numeric::convdetail::non_rounding_converter<Traits,RangeChecker,RawConverter>' being compiled with [
Traits=conv_traits, RangeChecker=boost::numeric::convdetail::generic_range_checker<conv_traits,boost::numeric::convdetail::non_applicable,boost::numeric::convdetail::GT_HiT<conv_traits>,boost::numeric::numeric_cast_traits<int,bool>::overflow_policy>, RawConverter=boost::numeric::raw_converter<conv_traits>
] c:\test\boost\boost\numeric\conversion\cast.hpp(53) : see reference to class template instantiation 'boost::numeric::converter<T,S,Traits,OverflowHandler,Float2IntRounder,RawConverter,UserRangeChecker>' being compiled with [
T=int, S=bool, Traits=conv_traits, OverflowHandler=boost::numeric::numeric_cast_traits<int,bool>::overflow_policy, Float2IntRounder=boost::numeric::Trunc<bool>, RawConverter=boost::numeric::raw_converter<conv_traits>, UserRangeChecker=boost::numeric::numeric_cast_traits<int,bool>::range_checking_policy
]
The code that may lead to warning is like this:
int val = boost::numeric_cast<int>(true);