22 lines · plain
1.. title:: clang-tidy - readability-static-definition-in-anonymous-namespace2 3readability-static-definition-in-anonymous-namespace4====================================================5 6Finds static function and variable definitions in anonymous namespace.7 8In this case, ``static`` is redundant, because anonymous namespace limits the9visibility of definitions to a single translation unit.10 11.. code-block:: c++12 13 namespace {14 static int a = 1; // Warning.15 static const int b = 1; // Warning.16 namespace inner {17 static int c = 1; // Warning.18 }19 }20 21The check will apply a fix by removing the redundant ``static`` qualifier.22