struct Foo { //Foo() = default; int i{}; static const float cf; }; const float Foo::cf = 0.1f; struct Bar { Foo f; int j{}; }; int main() { Bar b; return b.f.i + b.j; }
Output:
"C:\Program Files\Cppcheck\cppcheck.exe" --inconclusive --enable=all foo.cpp Checking foo.cpp ... foo.cpp:15:13: error: Uninitialized variable: i [uninitvar] return b.f.i + b.j; ^
cppcheck gets confused by the static const float member. The warning disappears when cf is removed or a default constructor is added to Foo-
cf
Foo
Can anybody reproduce this?
Thanks! I can reproduce. I created ticket https://trac.cppcheck.net/ticket/10119
Log in to post a comment.
Output:
cppcheck gets confused by the static const float member. The warning disappears when
cf
is removed or a default constructor is added toFoo
-Can anybody reproduce this?
Thanks! I can reproduce. I created ticket https://trac.cppcheck.net/ticket/10119