| 1 |
.. title:: clang-tidy - readability-static-accessed-through-instance |
| 2 |
|
| 3 |
readability-static-accessed-through-instance |
| 4 |
============================================ |
| 5 |
|
| 6 |
Checks for member expressions that access static members through instances, and |
| 7 |
replaces them with uses of the appropriate qualified-id. |
| 8 |
|
| 9 |
Example: |
| 10 |
|
| 11 |
The following code: |
| 12 |
|
| 13 |
.. code-block:: c++ |
| 14 |
|
| 15 |
struct C { |
| 16 |
static void foo(); |
| 17 |
static int x; |
| 18 |
}; |
| 19 |
|
| 20 |
C *c1 = new C(); |
| 21 |
c1->foo(); |
| 22 |
c1->x; |
| 23 |
|
| 24 |
is changed to: |
| 25 |
|
| 26 |
.. code-block:: c++ |
| 27 |
|
| 28 |
C *c1 = new C(); |
| 29 |
C::foo(); |
| 30 |
C::x; |
| 31 |
|