errno as a bit-fieldAuthors: Jay Ghiron
Date: 2026-03-13
Submitted against: C23
Status: Open
No wording exists currently to say that errno cannot expand to a
bit-field lvalue that has type int:
The macros are
...
errnowhich expands to a modifiable lvalue that has type
intand thread storage duration,
(C23 7.5 "Errors <errno.h>" paragraph 2.)
Additionally it does not forbid register from being used, though
that is exclusive with thread storage duration. If it were allowed to
be a bit-field expression or use register, then &errno would be
invalid. The wording for errno also says that the lvalue itself has
thread storage duration, rather than the object which it refers to.
This is inconsistent with the rest of the standard which uses storage
duration as a property of objects, rather than of expressions.
Modify C23 7.5 paragraph 2:
errnowhich expands to a modifiable lvalue that has type
intand thread storage durationwherein the designated object has thread storage duration, is not a bit-field, and is not declared with theregisterstorage-class specifier,