id summary reporter owner description type status milestone component version severity resolution keywords cc 13120 optional o. x<(size_t)0 is different to x<0 harris.pc@… Fernando Cacciola "This is a very subtle but key bug. Comparing slightly different types changes the way the comparison is done. {{{ #include #include int main() { boost::optional x; assert((x < (size_t)0) == (x < 0)); return 0; } }}} result: {{{ $ g++ -g -I boost_1_64_0/ -o test_optional-d test_optional.cpp $ ./test_optional-d $ test_optional.cpp:7: int main(): Assertion `(x < (size_t)0) == (x < 0)' failed. }}} I am scared to think what this might affect in my code... --- I would actually prefer to turn off the implicit cast in operator<(), and only allow : optional < optional I'd rather it throw a compile error and instead force me to do something like if (x && *x < 0) Because I do not always thing 'none' should be 'less than' anything. It should not be comparable. " Bugs new To Be Determined optional Boost 1.64.0 Showstopper