diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index ea6263988..8e589a603 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -6854,6 +6854,16 @@ void Tokenizer::simplifyStructDecl() tok = tok->next(); tok->insertToken(name.c_str()); } + else if (tok->next()->str() == ";") + { + Token *previous = tok1->previous(); + previous->deleteNext(); + previous->deleteNext(); + tok1 = previous->next(); + previous = tok->previous(); + previous->deleteNext(); + previous->deleteNext(); + } tok = tok1->next(); } diff --git a/test/testclass.cpp b/test/testclass.cpp index 6c26d24d5..3cfa1aa2f 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -2100,6 +2100,20 @@ private: " void foo() { }\n" "};"); ASSERT_EQUALS("[test.cpp:4]: (style) The function 'Fred::foo' can be const\n", errout.str()); + + checkConst("struct fast_string\n" + "{\n" + " union\n" + " {\n" + " char buff[100];\n" + " };\n" + " void set_type(char t);\n" + "};\n" + "inline void fast_string::set_type(char t)\n" + "{\n" + " buff[10] = t;\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void const7()