<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/86642>86642</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang-tidy error: static class variable is non-const and globally accessible, consider making it const
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          h1laryz
      </td>
    </tr>
</table>

<pre>
    **Version**
```
$ clang-tidy --version
Resource filename: /home/h1lary/.local/lib/python3.8/site-packages/clang_tidy/data/bin/clang-tidy
LLVM (http://llvm.org/):
  LLVM version 17.0.1
  Optimized build.
```

**.h file:**
```
class A
{
private:
 static std::atomic_flag s_InstanceFlag;
}
```

**.cpp file:**
`std::atomic_flag A::s_InstanceFlag;`

**error:**
```
Resource filename: /home/h1lary/.local/lib/python3.8/site-packages/clang_tidy/data/bin/clang-tidy 
/home/h1lary/cxx/test/src/A.cpp: error: variable 's_InstanceFlag' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
 5 | std::atomic_flag A::s_InstanceFlag;
      |           
``` 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVEtvqzgU_jVmY4Hg8EoWLJJUSCN1NNIsuq2MOQFPjY1sk2n660fmkYza9N7FXVxkydjH53zfeTJrRacQK5IfSf4UsMn12lR9Ipm5fgSNbq8VgQOBwwsaK7RaDiR-IvGBFPG6liNklEumutCJ9krD8LKqzNK_0erJcKRnIVGxAUl6oATqXg_otxmRQB1JzZkkUEvREKjHq-u1SqMdgdoKh-HI-Bvr0BKoZ7BXD0agbpljBOpGqE0y01jAn59f_qQEdr1zI0kPBGoPIC9DpE03n_b-en5L6fx6JU-TMoqjZBP9NToxiA9saTMJ2UaPA7GGw6-onx2eQb-NHJfMWrrJyuPyMxpxYQ7vxKxjTnBqXevv0gNzehD89SxZR-3rH8o6pjjWknUkPW7Gnn5OkY_jNyQfQh2Wq6-Ij4yjMdr82PvfVBl0o_kFiL-_E6gdWudNG06gnoPkeW3-0AszgjUSKYHyUyigpMJSpVXItbKOMtXSTuqGSXmljHO0VjQSCZyofyBaNHRgb0J1VDi66JD8yMeRa4PdJFqUQqEN2UWLNrwZDhej4UbFEjiF_zKjhOpsyGw4k7UkX2uA5pSUp8f1821S18L3n1e-f59ySYO2Stt9umcBVkmZJFkGZZoHfcUSiJu2xDxvAc5ptsuxgJJj3uR830IZiApiyOIUiniX5WkenZtzBnl83hV5USR7IFmMAxMy2lo2ENZOWO2KIoNAsgalnScYwP86H8BPNFN5pbCZOkuyWArr7N2ME05idbrXxC29a68tnXnL9a-mNZiMrPwQsrcp1AnXT03E9bCOpHULR6P_Qe5LcHbWl_Xs738BAAD__8N5uys">