Fixed #2307 (No constructor defined false positive when class is enclosed in namespace)
This commit is contained in:
parent
e0a0ed6fac
commit
845d1491f9
|
@ -7900,7 +7900,7 @@ void Tokenizer::removeExceptionSpecifications(Token *tok) const
|
|||
tok->deleteNext();
|
||||
}
|
||||
|
||||
else if (Token::Match(tok, "class %type%"))
|
||||
else if (Token::Match(tok, "class|namespace|struct %type%"))
|
||||
{
|
||||
while (tok && !Token::Match(tok, "[;{]"))
|
||||
tok = tok->next();
|
||||
|
|
|
@ -235,6 +235,7 @@ private:
|
|||
|
||||
TEST_CASE(removeExceptionSpecification1);
|
||||
TEST_CASE(removeExceptionSpecification2);
|
||||
TEST_CASE(removeExceptionSpecification3);
|
||||
|
||||
TEST_CASE(gt); // use "<" comparisons instead of ">"
|
||||
|
||||
|
@ -4200,6 +4201,25 @@ private:
|
|||
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void removeExceptionSpecification3()
|
||||
{
|
||||
const char code[] = "namespace A {\n"
|
||||
" struct B {\n"
|
||||
" B() throw ()\n"
|
||||
" { }\n"
|
||||
" };\n"
|
||||
"};\n";
|
||||
|
||||
const char expected[] = "namespace A {\n"
|
||||
"struct B {\n"
|
||||
"B ( )\n"
|
||||
"{ }\n"
|
||||
"} ;\n"
|
||||
"} ;";
|
||||
|
||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
|
||||
void gt()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue