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);
|
syntaxError(tok);
|
||||||
if (Token::Match(tok, ";|(|[ %comp%"))
|
if (Token::Match(tok, ";|(|[ %comp%"))
|
||||||
syntaxError(tok);
|
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);
|
syntaxError(tok);
|
||||||
if (Token::Match(tok, "[+-] [;,)]}]") && !(isCPP() && Token::Match(tok->previous(), "operator [+-] ;")))
|
if (Token::Match(tok, "[+-] [;,)]}]") && !(isCPP() && Token::Match(tok->previous(), "operator [+-] ;")))
|
||||||
syntaxError(tok);
|
syntaxError(tok);
|
||||||
|
|
|
@ -6754,6 +6754,12 @@ private:
|
||||||
" for (my_struct ms : { my_struct{ .x=5, .y{42} } }) {} "
|
" 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
|
// op op
|
||||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { dostuff (x==>y); }"), InternalError, "syntax error: == >");
|
ASSERT_THROW_EQUALS(tokenizeAndStringify("void f() { dostuff (x==>y); }"), InternalError, "syntax error: == >");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue