Issue |
145680
|
Summary |
[clang-tidy] False positives bugprone-dynamic-static-initializers
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
carlosgalvezp
|
I believe the check warns incorrectly in the following cases:
```cpp
#include <limits>
template <typename T>
constexpr T kMin{std::numeric_limits<T>::min()};
template <int n>
struct X
{
static constexpr int xn{n};
};
```
```bash
$ clang-tidy --checks=-*,bugprone-dynamic-static-initializers foo.hpp -- -fno-threadsafe-statics
589 warnings generated.
/tmp/foo.hpp:4:13: warning: static variable 'kMin' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
4 | constexpr T kMin{std::numeric_limits<T>::min()};
| ^
/tmp/foo.hpp:9:24: warning: static variable 'xn' may be dynamically initialized in this header file [bugprone-dynamic-static-initializers]
9 | static constexpr int xn{n};
| ^
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs