AST: Fixed AST for struct initialisation
This commit is contained in:
parent
149d11d9ad
commit
8a72bb8aa8
|
@ -540,7 +540,10 @@ static void compileTerm(Token *&tok, AST_state& state)
|
|||
if (tok->link() != tok->next()) {
|
||||
state.inArrayAssignment++;
|
||||
compileUnaryOp(tok, state, compileExpression);
|
||||
state.inArrayAssignment--;
|
||||
while (Token::Match(tok, "} [,}]") && state.inArrayAssignment > 0U) {
|
||||
tok = tok->next();
|
||||
state.inArrayAssignment--;
|
||||
}
|
||||
} else {
|
||||
state.op.push(tok);
|
||||
}
|
||||
|
|
|
@ -8598,6 +8598,7 @@ private:
|
|||
ASSERT_EQUALS("name_bytes[bits~unusedBits>>unusedBits<<{=", testAst("const uint8_t name_bytes[] = { (~bits >> unusedBits) << unusedBits };"));
|
||||
ASSERT_EQUALS("abuf0{={=", testAst("a = { .buf = { 0 } };"));
|
||||
ASSERT_EQUALS("tset{=", testAst("struct cgroup_taskset tset = {};"));
|
||||
ASSERT_EQUALS("s1a&,{2b&,{,{=", testAst("s = { {1, &a}, {2, &b} };"));
|
||||
|
||||
// template paratheses: <>
|
||||
ASSERT_EQUALS("stdfabs::m_similarity(numeric_limitsepsilon::(<=return", testAst("return std::fabs(m_similarity) <= numeric_limits<double>::epsilon();")); // #6195
|
||||
|
|
Loading…
Reference in New Issue