Warning: That file was not part of the compilation database. It may have many parsing errors.

1// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
2
3class CE {
4 constexpr static int i = 5; // OK: inline variable definition.
5};
6
7inline int i = 5; // OK: inline variable definition.
8
9int b = 1;
10// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
11
12// OK: C++14 variable template.
13template <class T>
14constexpr T pi = T(3.1415926L);
15

Warning: That file was not part of the compilation database. It may have many parsing errors.

source code of clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers-1z.hpp