From 796c3e101f93634cb27ee90d4243401e54140c31 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 12 Mar 2013 08:05:03 -0700 Subject: [PATCH] Implemented better fix for #4644 --- lib/tokenize.cpp | 4 ++-- test/testtokenize.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2e83066cd..d0d058fdc 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2529,7 +2529,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::mapisName()) { - if (tok2->str() == "class" || tok2->str() == "struct" || tok2->str() == "union") { + if (tok2->str() == "class" || tok2->str() == "struct" || tok2->str() == "union" || tok2->str() == "typename") { hasstruct = true; typeCount = 0; } else if (tok2->str() == "const") { @@ -2712,7 +2712,7 @@ void Tokenizer::setVarId() notstart.insert("return"); notstart.insert("sizeof"); if (!isC()) { - static const char *str[] = {"delete","friend","new","throw","using","virtual","explicit","typename"}; + static const char *str[] = {"delete","friend","new","throw","using","virtual","explicit"}; notstart.insert(str, str+(sizeof(str)/sizeof(*str))); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 39a4ec013..8caf674b0 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4287,6 +4287,9 @@ private: void varid_typename() { ASSERT_EQUALS("\n\n##file 0\n" "1: template < int d , typename A , typename B >\n", tokenizeDebugListing("template")); + + ASSERT_EQUALS("\n\n##file 0\n" + "1: typename A a@1 ;\n", tokenizeDebugListing("typename A a;")); } void varidclass1() {