| 1 |
.. title:: clang-tidy - bugprone-forward-declaration-namespace |
| 2 |
|
| 3 |
bugprone-forward-declaration-namespace |
| 4 |
====================================== |
| 5 |
|
| 6 |
Checks if an unused forward declaration is in a wrong namespace. |
| 7 |
|
| 8 |
The check inspects all unused forward declarations and checks if there is any |
| 9 |
declaration/definition with the same name existing, which could indicate that |
| 10 |
the forward declaration is in a potentially wrong namespace. |
| 11 |
|
| 12 |
.. code-block:: c++ |
| 13 |
|
| 14 |
namespace na { struct A; } |
| 15 |
namespace nb { struct A {}; } |
| 16 |
nb::A a; |
| 17 |
// warning : no definition found for 'A', but a definition with the same name |
| 18 |
// 'A' found in another namespace 'nb::' |
| 19 |
|
| 20 |
This check can only generate warnings, but it can't suggest a fix at this point. |