diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 862f9ff25..9898293a9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3229,11 +3229,6 @@ bool Tokenizer::simplifyTokenList() delete _symbolDatabase; _symbolDatabase = NULL; - for (Token *tok = list.front(); tok; tok = tok->next()) { - if (Token::simpleMatch(tok, "* const")) - tok->deleteNext(); - } - // simplify references simplifyReference(); @@ -3435,6 +3430,13 @@ bool Tokenizer::simplifyTokenList() list.front()->assignProgressValues(); + // Create symbol database and then remove const keywords + getSymbolDatabase(); + for (Token *tok = list.front(); tok; tok = tok->next()) { + if (Token::simpleMatch(tok, "* const")) + tok->deleteNext(); + } + if (_settings->debug) { list.front()->printOut(0, list.getFiles()); diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 27e5cf399..1f779141d 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -2387,7 +2387,7 @@ private: " A* const a;\n" " B& operator=(const B& r) { }\n" "};"); - TODO_ASSERT_EQUALS("", "[test.cpp:4]: (warning) Member variable 'B::a' is not assigned a value in 'B::operator='.\n", errout.str()); // #3804 + ASSERT_EQUALS("", errout.str()); // #3804 check("struct B {\n" " const int a;\n"