Skip to content

[clang] spurious -Wexit-time-destructors warning for thread_local variable #155155

@jy-lefort

Description

@jy-lefort

Test case:

struct HasDestructor {
    ~HasDestructor () {}
};

static thread_local HasDestructor hasDestructor;

Compile with:

$ clang++ -Wexit-time-destructors -c test.cxx 
test.cxx:5:35: warning: declaration requires an exit-time destructor [-Wexit-time-destructors]
    5 | static thread_local HasDestructor hasDestructor;
      |                                   ^
1 warning generated.

It seems to me that the warning does not make sense for thread_local variables (assuming that "exit-time" is meant as "process exit-time" and not "thread exit-time").

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions