This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115f. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-06


1648. thread_local vs block extern declarations

Section: 9.2.2  [dcl.stc]     Status: C++14     Submitter: Richard Smith     Date: 2013-04-12

[Moved to DR at the September, 2013 meeting.]

According to 9.2.2 [dcl.stc] paragraph 4,

When thread_local is applied to a variable of block scope the storage-class-specifier static is implied if it does not appear explicitly.

This, presumably unintentionally, prohibits a declaration like

  void f() {
    extern thread_local int n;
  }

Proposed resolution (April, 2013):

When thread_local is applied to a variable of block scope the storage-class-specifier static is implied if it does not appear explicitly no other storage-class-specifier appears in the decl-specifier-seq.