Title
Specification of is_[un]signed unclear for non-arithmetic types
Status
c++14
Section
[meta.unary.prop]
Submitter
Daniel Krügler

Created on 2012-10-07.00:00:00 last changed 122 months ago

Messages

Date: 2013-04-19.22:36:19

Proposed resolution:

This wording is relative to N3376.

  1. Change Table 49 as indicated:

    Table 49 — Type property predicates
    Template Condition Preconditions
    template <class T>
    struct is_signed;
    If is_arithmetic<T>::value && is true, the same result as
    integral_constant<bool, T(-1) < T(0)>::value;
    otherwise, false.
     
    template <class T>
    struct is_unsigned;
    If is_arithmetic<T>::value && is true, the same result as
    integral_constant<bool, T(0) < T(-1)>::value;
    otherwise, false.
     
Date: 2013-04-20.00:00:00

[ 2013-04-20 Bristol ]

Date: 2013-03-15.00:00:00

[ 2013-03-15 Issues Teleconference ]

Moved to Tentatively Ready.

Date: 2012-10-07.14:47:30

The pre-conditions for the trait is_signed allow for any types as template arguments, including non-arithmetic ones.

But the current wording in Table 49 defining the predicate condition,

is_arithmetic<T>::value && T(-1) < T(0)

looks like real code and so leaves it open whether such argument types would create a well-formed instantiation of the trait template or not. As written this definition would lead to a hard instantiation error for a non-arithmetic type like e.g.

struct S {};

I would suggest that the wording clarifies that the instantiation would be valid for such types as well, by means of a specification that is not an exact code pattern. This also reflects how existing implementations behave.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-04-25 19:07:07adminsetstatus: voting -> wp
2013-04-19 22:36:19adminsetmessages: + msg6485
2013-04-19 22:36:19adminsetstatus: ready -> voting
2013-03-18 14:33:00adminsetmessages: + msg6417
2013-03-18 13:02:36adminsetstatus: new -> ready
2012-10-07 11:30:29adminsetmessages: + msg6162
2012-10-07 00:00:00admincreate