Another fix for 10739: internalAstError with decltype (#3738)
* Another fix for 10739: internalAstError with decltype * Format
This commit is contained in:
parent
b23ca879ed
commit
8b1ed9cbe1
|
@ -784,7 +784,13 @@ static void compileTerm(Token *&tok, AST_state& state)
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
}
|
}
|
||||||
} else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(|[")) {
|
} else if (!state.cpp || !Token::Match(tok, "new|delete %name%|*|&|::|(|[")) {
|
||||||
|
Token* tok2 = tok;
|
||||||
tok = skipDecl(tok);
|
tok = skipDecl(tok);
|
||||||
|
if (Token::simpleMatch(tok2, "decltype (")) {
|
||||||
|
Token* tok3 = tok2->next();
|
||||||
|
AST_state state1(state.cpp);
|
||||||
|
compileExpression(tok3, state1);
|
||||||
|
}
|
||||||
bool repeat = true;
|
bool repeat = true;
|
||||||
while (repeat) {
|
while (repeat) {
|
||||||
repeat = false;
|
repeat = false;
|
||||||
|
|
|
@ -6885,6 +6885,15 @@ private:
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("void a() {\n"
|
ASSERT_NO_THROW(tokenizeAndStringify("void a() {\n"
|
||||||
" [b = [] { ; }] {};\n"
|
" [b = [] { ; }] {};\n"
|
||||||
"}\n"));
|
"}\n"));
|
||||||
|
|
||||||
|
// #10739
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
||||||
|
" std::vector<int> b;\n"
|
||||||
|
"};\n"
|
||||||
|
"void c() {\n"
|
||||||
|
" a bar;\n"
|
||||||
|
" (decltype(bar.b)::value_type){};\n"
|
||||||
|
"}\n"));
|
||||||
}
|
}
|
||||||
void checkIfCppCast() {
|
void checkIfCppCast() {
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
||||||
|
|
Loading…
Reference in New Issue