diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 32072b402..0e73d66d0 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -649,7 +649,7 @@ private: --parlevel; } - else if (Token::simpleMatch(tok2, "sizeof (")) + else if (Token::Match(tok2, "sizeof|typeof (")) { tok2 = tok2->next()->link(); if (!tok2) diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index c23e67bdc..b69a977cd 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -1400,6 +1400,12 @@ private: " typeof(fred->x);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + checkUninitVar("void f() {\n" + " struct SData * s;\n" + " ab(typeof(s->status));\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } };