Opened 11 years ago

Closed 11 years ago

#695 closed defect (fixed)

convert<unsigned int>("-1") does not throw

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.8
Component: utility Version: trunk
Keywords: Cc:

Description

convert<unsigned int>("-1") does not throw but converts to x = 4294967295

Change History (6)

comment:1 Changed 11 years ago by Peter

Seems boost::lexical_cast has the same behavior, i.e., boost::lexical_cast<unsigned int>("-1") does not throw but returns 4294967295. I think this is unexpected behavior and I think we should try to thwow in this case.

comment:2 Changed 11 years ago by Peter

(In [2665]) add test for ticket #695 (refs #695)

comment:3 Changed 11 years ago by Peter

Milestone: yat 0.8
Resolution: worksforme
Status: newclosed

When building from a clean sheet, I cannot reproduce this error.

comment:4 Changed 11 years ago by Peter

Milestone: yat 0.8
Resolution: worksforme
Status: closedreopened

On Linux with gcc 4.5 the problem is not gone. utility.test and commandline.test fail and underlying problem is that convert("-1") does not throw.

comment:5 Changed 11 years ago by Peter

It works on Mac OS 10.6 with i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

comment:6 Changed 11 years ago by Peter

Resolution: fixed
Status: reopenedclosed

(In [2666]) fixes #695, added check in convert<unsigned type> that string cannot start with minus sign.

Note: See TracTickets for help on using tickets.