| 1 |
// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t |
| 2 |
|
| 3 |
class CE { |
| 4 |
constexpr static int i = 5; // OK: inline variable definition. |
| 5 |
}; |
| 6 |
|
| 7 |
inline int i = 5; // OK: inline variable definition. |
| 8 |
|
| 9 |
int 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. |
| 13 |
template <class T> |
| 14 |
constexpr T pi = T(3.1415926L); |