File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -19,25 +19,31 @@ The rule is an experimental rule that must be explicitly enabled in a rule set f
19
19
``` cpp
20
20
// A.h
21
21
struct X ;
22
+ ```
22
23
24
+ ```
23
25
// A.cpp
26
+ #include "A.h"
24
27
25
28
// Not flagged, declared in a header file.
26
29
struct X { int x; };
27
30
28
31
struct Y { double y; }; // warning: Move 'Y' to anonymous namespace or put a forward declaration in a common header included in this file.
29
32
30
- void f(); // warning: Move 'Y ' to anonymous namespace or put a forward declaration in a common header included in this file.
33
+ void f(); // warning: Move 'f ' to anonymous namespace or put a forward declaration in a common header included in this file.
31
34
```
32
35
33
- To resolve this issue :
36
+ One way to resolve these issues is to move ` struct Y ` into an anonymous namespace, and move the declaration of ` f ` into a header :
34
37
35
38
``` cpp
36
39
// A.h
37
40
struct X ;
38
41
void f ();
42
+ ```
39
43
44
+ ``` cpp
40
45
// A.cpp
46
+ #include " A.h"
41
47
42
48
// Not flagged, declared in a header file.
43
49
struct X { int x; };
@@ -48,5 +54,4 @@ namespace {
48
54
49
55
// Not flagged, declared in a header file.
50
56
void f();
51
-
52
57
```
You can’t perform that action at this time.
0 commit comments