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
3 changes: 2 additions & 1 deletion lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//---------------------------------------------------------------------------
#include "tokenlist.h"

#include "astutils.h"
#include "errorlogger.h"
#include "library.h"
#include "path.h"
Expand Down Expand Up @@ -1351,7 +1352,7 @@ static Token * createAstAtToken(Token *tok, bool cpp);
// Compile inner expressions inside inner ({..}) and lambda bodies
static void createAstAtTokenInner(Token * const tok1, const Token *endToken, bool cpp)
{
for (Token *tok = tok1; tok && tok != endToken; tok = tok ? tok->next() : nullptr) {
for (Token* tok = tok1; precedes(tok, endToken); tok = tok ? tok->next() : nullptr) {
if (tok->str() == "{" && !iscpp11init(tok)) {
const Token * const endToken2 = tok->link();
bool hasAst = false;
Expand Down
13 changes: 13 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6620,6 +6620,19 @@ class TestTokenizer : public TestFixture {
"}\n"));

ASSERT_NO_THROW(tokenizeAndStringify("a<b?0:1>()==3;"));

// #10336
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
" template <class b> a(b);\n"
"};\n"
"struct c;\n"
"void fn1(int, a);\n"
"void f() { fn1(0, {a{0}}); }\n"
"template <class> std::vector<c> g() {\n"
" int d;\n"
" for (size_t e = 0; e < d; e++)\n"
" ;\n"
"}\n"));
}

void checkNamespaces() {
Expand Down