Issue 1057: Standard library types as atomic types

Authors: Jay Ghiron
Date: 2026-05-11
Submitted against: C23
Status: Open

The standard on some occasions uses type categories such as character type to include atomic types:

If a value is stored into an object having no declared type through an lvalue having a type that is not a non-atomic character type, then the type of the lvalue becomes the effective type of the object for that access and for subsequent accesses that do not modify the stored value.

(C23 6.5.1 "General" paragraph 6.)

If the type category character type did not include atomic types, it would be redundant to mention non-atomic here. C2Y moves this wording into the definition of the type category byte type. Given this, it does not appear that standard library types such as size_t are forbidden from being atomic types. This would have some awkward consequences (assume __STDC_NO_ATOMICS__ is not defined):

#include<stddef.h>
_Atomic(size_t)x;/* possibly invalid */
size_t y;
int main(){
auto z=y;/* uses typeof_unqual(size_t) not size_t */
}

The same applies to ptrdiff_t, wchar_t, wint_t, intN_t, uintN_t, int_leastN_t, uint_leastN_t, int_fastN_t, uint_fastN_t, intptr_t, uintptr_t, intmax_t, uintmax_t, float_t, double_t, long_double_t, _Decimal32_t, _Decimal64_t, _FloatN_t, _DecimalN_t, time_t, clock_t, imaxdiv_t, div_t, ldiv_t, lldiv_t, wctrans_t, wctype_t, memory_order, and sig_atomic_t considering that it may also be volatile qualified. The same also applies to N3366 stdc_mcerr, it is described as an enumerated type similar to memory_order.

atomic_flag is described as a structure type, though it being atomic does not seem unreasonable. struct timespec, struct tm, and struct lconv surely cannot be atomic because of how they are named. jmp_buf can also not be atomic because it must be an array type. Future issues will discuss other types along with other problems that they have.

There seems to be three possible solutions:

  1. Add wording to each of the types mentioned above forbidding atomic types.
  2. Add wording forbidding atomic types that applies to all standard library types that can only be scalar types. Also add wording to the division types forbidding them from being atomic types.
  3. Clarify that type categories such as integer type and structure type do not include atomic types. This would have a very broad impact on the standard. If this is done, it would also be useful to clarify if qualifiers are included or not.