Fix lambda capture template syntax error (#4593)
This commit is contained in:
parent
f6c2afa2ea
commit
a5c16af16d
|
@ -7756,7 +7756,7 @@ void Tokenizer::findGarbageCode() const
|
|||
syntaxError(tok);
|
||||
if (Token::Match(tok, ";|(|[ %comp%"))
|
||||
syntaxError(tok);
|
||||
if (Token::Match(tok, "%cop%|= ]") && !(isCPP() && Token::Match(tok->previous(), "[|,|%num% &|=|> ]")))
|
||||
if (Token::Match(tok, "%cop%|= ]") && !(isCPP() && Token::Match(tok->previous(), "%type%|[|,|%num% &|=|> ]")))
|
||||
syntaxError(tok);
|
||||
if (Token::Match(tok, "[+-] [;,)]}]") && !(isCPP() && Token::Match(tok->previous(), "operator [+-] ;")))
|
||||
syntaxError(tok);
|
||||
|
|
|
@ -6754,6 +6754,12 @@ private:
|
|||
" for (my_struct ms : { my_struct{ .x=5, .y{42} } }) {} "
|
||||
"}"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("template <typename T> void foo() {} "
|
||||
"void h() { "
|
||||
" [func=foo<int>]{func();}(); "
|
||||
"}"));
|
||||
|
||||
|
||||
// op op
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { dostuff (x==>y); }"), InternalError, "syntax error: == >");
|
||||
|
||||
|
|
Loading…
Reference in New Issue