Issue 1035: wctrans_t and wctype_t as nullptr_t

Authors: Jay Ghiron
Date: 2026-03-24
Submitted against: C23
Status: Open
Cross-references: 1050, 1055

No wording exists currently to say that wctrans_t and wctype_t cannot be defined as nullptr_t:

The types declared are wint_t described in 7.31.1;

wctrans_t

which is a scalar type that can hold values which represent locale-specific character mappings; and

wctype_t

which is a scalar type that can hold values which represent locale-specific character classifications.

(C23 7.32.1 "Introduction" paragraph 2.)

Before C23 nullptr_t did not exist as a scalar type so wctrans_t and wctype_t could not be defined as nullptr_t, but in C23 nullptr_t was added as a scalar type which is what wctrans_t and wctype_t are defined in terms of. An example of where this matters is:

#include<wctype.h>
int main(){
bool b=true;
wctrans_t t=b?wctrans("example"):0;
}

If wctrans_t were defined as nullptr_t, then this program would have a constraint violation:

One of the following shall hold for the second and third operands:

(C23 6.5.16 "Conditional operator" paragraph 3.)

There seems to be no reason to allow for wctrans_t or wctype_t to be defined as nullptr_t. Such definitions would also not be sufficient to include all of the standard categories which are defined. The same is also true for bool, bit-precise integer types with a small width, and extended integer types with a small width.

Suggested correction

Modify C23 7.32.1 paragraph 2:

wctrans_t

which is a scalar type that can hold at least two nonzero values which represent locale-specific character mappings; and

wctype_t

which is a scalar type that can hold at least twelve nonzero values which represent locale-specific character classifications.

Note: Zero is already used to mean null for pointer types, though that is never clearly defined.


Comment from Issues list maintainer on 2026-11-26:

This issue was discussed at the November 2026 (Búzios) meeting of WG14. The committee agreed to respond that no change is needed, and Joseph Myers took an action item to write wording for the response.