Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1587,12 +1587,13 @@ static Token * createAstAtToken(Token *tok)
do {
tok2 = tok2->next();
tok2->setCpp11init(false);
if (Token::simpleMatch(tok2, "decltype")) {
if (Token::Match(tok2, "decltype|noexcept (")) {
AST_state state(cpp);
Token *tok3 = tok2->tokAt(2);
compileExpression(tok3, state);
tok2 = tok2->linkAt(1);
}
} while (tok2 != endTok);
} while (tok2 != endTok && !precedes(endTok, tok2));
}
return endTok;
}
Expand Down
4 changes: 4 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ class TestTokenizer : public TestFixture {
TEST_CASE(astrefqualifier);
TEST_CASE(astthrowdelete);
TEST_CASE(asttrailingdecltype);
TEST_CASE(astnoexcept);
TEST_CASE(astvardecl);
TEST_CASE(astnewscoped);

Expand Down Expand Up @@ -7026,6 +7027,9 @@ class TestTokenizer : public TestFixture {
ASSERT_EQUALS("Cc& MakeSpancdata.(csize.(,(",
testAst("template <typename C> constexpr auto MakeSpan(C &c) -> decltype(MakeSpan(c.data(), c.size())) {}"));
}
void astnoexcept() {
ASSERT_EQUALS("noexceptaswap.b((", testAst("void f() noexcept(noexcept(a.swap(b))) {}"));
Comment thread
danmar marked this conversation as resolved.
}

//Verify that returning a newly constructed object generates the correct AST even when the class name is scoped
//Addresses https://trac.cppcheck.net/ticket/9700
Expand Down