Fix 9245: Synax error on valid C++14 code: AST broken, binary operator '=' doesn't have two operands. (#3400)
This commit is contained in:
parent
c92dab1329
commit
6d65f86871
|
@ -4525,9 +4525,7 @@ void Tokenizer::createLinks2()
|
||||||
if (!top2 || top2->str() != "<") {
|
if (!top2 || top2->str() != "<") {
|
||||||
if (token->str() == ">>")
|
if (token->str() == ">>")
|
||||||
continue;
|
continue;
|
||||||
if (token->next() &&
|
if (!Token::Match(token->next(), "%name%|%cop%|::|,|(|)|{|}|;|[|:|.|=|...") &&
|
||||||
!Token::Match(token->next(), "%name%|%comp%|&|&&|*|::|,|(|)|{|}|;|[|:|.|=") &&
|
|
||||||
!Token::simpleMatch(token->next(), "...") &&
|
|
||||||
!Token::Match(token->next(), "&& %name% ="))
|
!Token::Match(token->next(), "&& %name% ="))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1738,12 +1738,13 @@ private:
|
||||||
|
|
||||||
void cliCode() {
|
void cliCode() {
|
||||||
// #8913
|
// #8913
|
||||||
ASSERT_THROW(checkCode("public ref class LibCecSharp : public CecCallbackMethods {\n"
|
ASSERT_NO_THROW(checkCode(
|
||||||
"array<CecAdapter ^> ^ FindAdapters(String ^ path) {}\n"
|
"public ref class LibCecSharp : public CecCallbackMethods {\n"
|
||||||
"bool GetDeviceInformation(String ^ port, LibCECConfiguration ^configuration, uint32_t timeoutMs) {\n"
|
"array<CecAdapter ^> ^ FindAdapters(String ^ path) {}\n"
|
||||||
"bool bReturn(false);\n"
|
"bool GetDeviceInformation(String ^ port, LibCECConfiguration ^configuration, uint32_t timeoutMs) {\n"
|
||||||
"}\n"
|
"bool bReturn(false);\n"
|
||||||
"};"), InternalError);
|
"}\n"
|
||||||
|
"};"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void enumTrailingComma() {
|
void enumTrailingComma() {
|
||||||
|
|
|
@ -6586,6 +6586,15 @@ private:
|
||||||
"template <class> struct F;\n"
|
"template <class> struct F;\n"
|
||||||
"int main() { using T = void (*)(a<j<F, char[]>>); }\n"));
|
"int main() { using T = void (*)(a<j<F, char[]>>); }\n"));
|
||||||
|
|
||||||
|
// #9245
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
||||||
|
" typedef int b;\n"
|
||||||
|
" operator b();\n"
|
||||||
|
"};\n"
|
||||||
|
"template <int> using c = a;\n"
|
||||||
|
"template <int d> c<d> e;\n"
|
||||||
|
"auto f = ((e<4> | 0));\n"));
|
||||||
|
|
||||||
// #9340
|
// #9340
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify(
|
ASSERT_NO_THROW(tokenizeAndStringify(
|
||||||
"struct a {\n"
|
"struct a {\n"
|
||||||
|
@ -6608,6 +6617,13 @@ private:
|
||||||
" ;\n"
|
" ;\n"
|
||||||
"}\n"));
|
"}\n"));
|
||||||
|
|
||||||
|
// #10015
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify(
|
||||||
|
"void func() {\n"
|
||||||
|
" if (std::is_same_v<int, int> || 1)\n"
|
||||||
|
" ;\n"
|
||||||
|
"}\n"));
|
||||||
|
|
||||||
// #10309
|
// #10309
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify(
|
ASSERT_NO_THROW(tokenizeAndStringify(
|
||||||
"using a = void *;\n"
|
"using a = void *;\n"
|
||||||
|
|
Loading…
Reference in New Issue