This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
bool type in make_signed and make_unsignedSection: 21.3.8.4 [meta.trans.sign] Status: New Submitter: Jan Schultke Opened: 2026-10-23 Last modified: 2026-10-31
Priority: Not Prioritized
View all issues with New status.
Discussion:
The intent is for make_signed and make_unsigned to reject bool, which is
enforced by their Mandates element. However, enumerations whose underlying
type is bool are accepted (presumably by accident), with implementation divergence:
using SB = std::make_signed_t<bool>; // all reject
enum E : bool {};
using SE = std::make_signed_t<E>; // libc++ rejects, others yield signed char
Proposed resolution:
This wording is relative to N5054.
Modify 21.3.8.4 [meta.trans.sign] as indicated:
| Template | Comments |
|---|---|
template <class T>
|
If T is a (possibly cv-qualified) signed integer type (6.9.3 [basic.fundamental]) then themember typedef type denotes T; otherwise, if T is a (possiblycv-qualified) unsigned integer type then type denotes the corresponding signed integer type, with the same cv-qualifiers as T;otherwise, type denotes the signed integer type with smallest rank (6.9.7 [conv.rank]) for which sizeof(T) == sizeof(type), with the samecv-qualifiers as T.Mandates: T is either an integral boolor an enumeration type whose underlying type is not bool.
|
template <class T>
|
If T is a (possibly cv-qualified) unsigned integer type (6.9.3 [basic.fundamental]) then themember typedef type denotes T; otherwise, if T is a (possiblycv-qualified) signed integer type then type denotes the corresponding unsigned integer type, with the same cv-qualifiers as T; otherwise,type denotes the unsigned integer type with smallest rank (6.9.7 [conv.rank]) for which sizeof(T) == sizeof(type), with the same cv-qualifiers asT.Mandates: T is either an integral boolor an enumeration type whose underlying type is not bool.
|