1 | // RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- -- -fdelayed-template-parsing |
2 | |
3 | template <class T> |
4 | struct PositiveFieldBeforeConstructor { |
5 | int F; |
6 | bool G /* with comment */; |
7 | int *H; |
8 | PositiveFieldBeforeConstructor() {} |
9 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these fields: F, G, H |
10 | }; |
11 | // Explicit instantiation. |
12 | template class PositiveFieldBeforeConstructor<int>; |
13 | |
14 | template <class T> |
15 | struct PositiveFieldAfterConstructor { |
16 | PositiveFieldAfterConstructor() {} |
17 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor does not initialize these fields: F, G, H |
18 | int F; |
19 | bool G /* with comment */; |
20 | int *H; |
21 | }; |
22 | // Explicit instantiation. |
23 | template class PositiveFieldAfterConstructor<int>; |
24 | |
25 | // This declaration isn't used and won't be parsed 'delayed-template-parsing'. |
26 | // The body of the declaration is 'null' and may cause crash if not handled |
27 | // properly by checkers. |
28 | template <class T> |
29 | struct UnusedDelayedConstructor { |
30 | UnusedDelayedConstructor() {} |
31 | int F; |
32 | }; |
33 | |