Implemented better fix for #4644

This commit is contained in:
PKEuS 2013-03-12 08:05:03 -07:00
parent 2333aa2cc7
commit 796c3e101f
2 changed files with 5 additions and 2 deletions

View File

@ -2529,7 +2529,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
bool hasstruct = false; // Is there a "struct" or "class"?
while (tok2) {
if (tok2->isName()) {
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)));
}

View File

@ -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<int d, typename A, typename B>"));
ASSERT_EQUALS("\n\n##file 0\n"
"1: typename A a@1 ;\n", tokenizeDebugListing("typename A a;"));
}
void varidclass1() {