Issue 1009: extern thread_local should not be an external definition

Authors: Joseph Myers
Date: 2025-03-12
Submitted against: C23
Status: Review

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.

Suggested correction

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 without extern, the declaration is an external definition for the identifier.


Comment from Issues list maintainer on 2025-09-01:

At the August 2025 (Brno) meeting of WG14, the suggested correction was accepted, subject to review at the next meeting.

Proposed correction

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 without extern, the declaration is an external definition for the identifier.