fix removal of throw() from const functions

This commit is contained in:
Robert Reif 2011-03-16 19:54:52 -04:00
parent fec9edf628
commit 7e04ea0859
2 changed files with 13 additions and 2 deletions

View File

@ -8558,9 +8558,15 @@ void Tokenizer::removeExceptionSpecifications(Token *tok) const
else if (tok->str() == "}")
break;
else if (Token::simpleMatch(tok, ") throw ("))
else if (Token::Match(tok, ") const| throw ("))
{
Token::eraseTokens(tok, tok->tokAt(2)->link());
if (tok->next()->str() == "const")
{
Token::eraseTokens(tok->next(), tok->tokAt(3)->link());
tok = tok->next();
}
else
Token::eraseTokens(tok, tok->tokAt(2)->link());
tok->deleteNext();
}

View File

@ -3301,6 +3301,11 @@ private:
" { return 0; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" const std::string foo() const throw() { return ""; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}
void const2()