1// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- -- -fdelayed-template-parsing
2
3template <class T>
4struct 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.
12template class PositiveFieldBeforeConstructor<int>;
13
14template <class T>
15struct 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.
23template 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.
28template <class T>
29struct UnusedDelayedConstructor {
30 UnusedDelayedConstructor() {}
31 int F;
32};
33

source code of clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/pro-type-member-init-delayed.cpp