Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2003-09-17 04:55:49


Bugs item #807724, was opened at 2003-09-17 02:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=807724&group_id=7586

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: cast.hpp: greater_than_type_max<false, false> int/uint bug

Initial Comment:
Submitted by holger.joukl_at_[hidden]

File boost/boost/boost/cast.hpp:

If the greater_than_type_max check method is called in

this specialization:

  greater_than_type_max<false, false>.check(x, y)

with

  unsigned int x

and

  int y=INT_MAX,

and x is bigger than INT_MAX, the check fails.

Maybe it could be done this way (but I am C++ newbie,

so I might

overlook the subtleties):

 *** cast.hpp.orig Wed Sep 17 11:45:33 2003

--- cast.hpp Wed Sep 17 11:47:12 2003

***************

*** 295,301 ****

          // will work with every compiler I know of.

          template <class X, class Y>

          static inline bool check(X x, Y)

! { return

static_cast<X>(static_cast<Y>(x)) != x; }

      };

 

  #else // use #pragma hacks if available

--- 295,301 ----

          // will work with every compiler I know of.

          template <class X, class Y>

          static inline bool check(X x, Y)

! { return

(static_cast<X>(static_cast<Y>(x)) != x) ||

(static_cast<Y>(x) < 0); }

      };

 

  #else // use #pragma hacks if available

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=807724&group_id=7586

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk