a reproducer code that I just posted to the LLVM bug tracker (for
clang-tidy) also triggers a false positive with cppcheck. See here for the
code snippet https://github.com/llvm/llvm-project/issues/70464
cppcheck --enable=all repro.cpp
Checking repro.cpp ...
repro.cpp:9:4: warning: Member variable 'foo < double >::x' is not
initialized in the constructor. Maybe it should be initialized directly in
the class foo < double >? [uninitDerivedMemberVar]
bar(double x) : foo{x} { }
^
The problem that both clang-tidy and cppcheck appear to trip over is the
fact that I use a brace initializer in the constructor initializer list of
a derived class.
Hi all,
a reproducer code that I just posted to the LLVM bug tracker (for
clang-tidy) also triggers a false positive with cppcheck. See here for the
code snippet https://github.com/llvm/llvm-project/issues/70464
cppcheck --enable=all repro.cpp
Checking repro.cpp ...
repro.cpp:9:4: warning: Member variable 'foo < double >::x' is not
initialized in the constructor. Maybe it should be initialized directly in
the class foo < double >? [uninitDerivedMemberVar]
bar(double x) : foo{x} { }
^
The problem that both clang-tidy and cppcheck appear to trip over is the
fact that I use a brace initializer in the constructor initializer list of
a derived class.
Christian
Thanks for reporting, fixed by https://github.com/danmar/cppcheck/pull/5606