File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1583,10 +1583,15 @@ static Token * createAstAtToken(Token *tok)
1583
1583
}
1584
1584
if (Token *const endTok = skipMethodDeclEnding (tok)) {
1585
1585
if (Token::simpleMatch (endTok, " {" )) {
1586
- const Token *tok2 = tok;
1586
+ Token *tok2 = tok;
1587
1587
do {
1588
1588
tok2 = tok2->next ();
1589
1589
tok2->setCpp11init (false );
1590
+ if (Token::simpleMatch (tok2, " decltype" )) {
1591
+ AST_state state (cpp);
1592
+ Token *tok3 = tok2->tokAt (2 );
1593
+ compileExpression (tok3, state);
1594
+ }
1590
1595
} while (tok2 != endTok);
1591
1596
}
1592
1597
return endTok;
Original file line number Diff line number Diff line change @@ -392,6 +392,7 @@ class TestTokenizer : public TestFixture {
392
392
TEST_CASE (astcase);
393
393
TEST_CASE (astrefqualifier);
394
394
TEST_CASE (astthrowdelete);
395
+ TEST_CASE (asttrailingdecltype);
395
396
TEST_CASE (astvardecl);
396
397
TEST_CASE (astnewscoped);
397
398
@@ -7020,6 +7021,12 @@ class TestTokenizer : public TestFixture {
7020
7021
ASSERT_EQUALS (" a(" , testAst (" class a { virtual ~a() throw() = delete; };" ));
7021
7022
}
7022
7023
7024
+ void asttrailingdecltype () {
7025
+ ASSERT_EQUALS (" Cc& csize.(" , testAst (" template<class C> constexpr auto s(const C &c) noexcept -> decltype(c.size()) {}" ));
7026
+ ASSERT_EQUALS (" Cc& MakeSpancdata.(csize.(,(" ,
7027
+ testAst (" template <typename C> constexpr auto MakeSpan(C &c) -> decltype(MakeSpan(c.data(), c.size())) {}" ));
7028
+ }
7029
+
7023
7030
// Verify that returning a newly constructed object generates the correct AST even when the class name is scoped
7024
7031
// Addresses https://trac.cppcheck.net/ticket/9700
7025
7032
void astnewscoped () {
You can’t perform that action at this time.
0 commit comments