https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98816
Bug ID: 98816
Summary: The thread_local specifier appear on the declaration
of static member function is compilied by gcc
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: xmh970252187 at gmail dot com
Target Milestone: ---
struct A{
thread_local void static fun(){};
};
int main(){
}
This code can be compiled on all versions of GCC compilers. However, the
standard says:
>The thread_local specifier indicates that the named entity has thread storage
>duration. It shall be applied only to the names of variables of namespace or
>block scope and to the names of static data members.
That means the `thread_local` specifier can be applied to static data members
rather than static member functions. In this example, the declaration of `fun`
should be ill-formed.