fix removal of throw() from const functions
This commit is contained in:
parent
fec9edf628
commit
7e04ea0859
|
@ -8558,8 +8558,14 @@ void Tokenizer::removeExceptionSpecifications(Token *tok) const
|
||||||
else if (tok->str() == "}")
|
else if (tok->str() == "}")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else if (Token::simpleMatch(tok, ") throw ("))
|
else if (Token::Match(tok, ") const| throw ("))
|
||||||
{
|
{
|
||||||
|
if (tok->next()->str() == "const")
|
||||||
|
{
|
||||||
|
Token::eraseTokens(tok->next(), tok->tokAt(3)->link());
|
||||||
|
tok = tok->next();
|
||||||
|
}
|
||||||
|
else
|
||||||
Token::eraseTokens(tok, tok->tokAt(2)->link());
|
Token::eraseTokens(tok, tok->tokAt(2)->link());
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3301,6 +3301,11 @@ private:
|
||||||
" { return 0; }\n"
|
" { return 0; }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkConst("class Fred {\n"
|
||||||
|
" const std::string foo() const throw() { return ""; }\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void const2()
|
void const2()
|
||||||
|
|
Loading…
Reference in New Issue