diff --git a/lib/ctu.cpp b/lib/ctu.cpp index f4d1f3699..ab3a7155d 100644 --- a/lib/ctu.cpp +++ b/lib/ctu.cpp @@ -402,6 +402,8 @@ CTU::FileInfo *CTU::getFileInfo(const Tokenizer *tokenizer) argtok = addr ? addr : isReferenceArg(argtok); if (!argtok || argtok->values().size() != 1U) continue; + if (argtok->variable() && argtok->variable()->isClass()) + continue; const ValueFlow::Value &v = argtok->values().front(); if (v.valueType == ValueFlow::Value::ValueType::UNINIT && !v.isInconclusive()) { diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index f5f8f3744..5066b6516 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -6597,6 +6597,17 @@ private: " return n;\n" "}\n"); ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:1]: (error) Using argument i that points at uninitialized variable n\n", errout.str()); + + ctu("typedef struct { int type; int id; } Stem;\n" + "void lookupStem(recodeCtx h, Stem *stem) {\n" + " i = stem->type & STEM_VERT;\n" + "}\n" + "void foo() {\n" + " Stem stem;\n" + " stem.type = 0;\n" + " lookupStem(h, &stem);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } };