This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

554. Problem with lwg DR 184 numeric_limits<bool>

Section: [numeric.special] Status: NAD Submitter: Howard Hinnant Opened: 2006-01-29 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [numeric.special].

View all issues with NAD status.


I believe we have a bug in the resolution of: 184 (WP status).

The resolution spells out each member of numeric_limits<bool>. The part I'm having a little trouble with is:

static const bool traps = false;

Should this not be implementation defined? Given:

int main()
     bool b1 = true;
     bool b2 = false;
     bool b3 = b1/b2;

If this causes a trap, shouldn't numeric_limits<bool>::traps be true?

Proposed resolution:


-3- The specialization for bool shall be provided as follows:

namespace std { 
   template <> class numeric_limits<bool> {
      static const bool traps = false implementation-defined;

[ Redmond: NAD because traps refers to values, not operations. There is no bool value that will trap. ]