extern thread_local
should not be an external definitionAuthors: Joseph Myers
Date: 2025-03-12
Submitted against: C23
Status: Open
The following issue was pointed out by Ori Bernstein in reflector message 25279.
C23 6.9.3 says:
If the declaration of an identifier for an object has file scope and an initializer, or has file scope and storage-class specifier
thread_local
, the declaration is an external definition for the identifier.
This fails to allow for the combination extern thread_local
, which
should not be an external definition.
In C23 6.9.3, amend the quoted paragraph as follows:
If the declaration of an identifier for an object has file scope and an initializer, or has file scope and storage-class specifier
thread_local
withoutextern
, the declaration is an external definition for the identifier.