Skip to content

Commit e0ce648

Browse files
Fix #12806 FP constParameterReference related to designated initializer (#6486)
1 parent 7ab4ae7 commit e0ce648

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: lib/tokenlist.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static void compileTerm(Token *&tok, AST_state& state)
830830
} else if ((state.cpp && iscpp11init(tok)) || Token::simpleMatch(tok->previous(), "] {")) {
831831
Token *const end = tok->link();
832832
if (state.op.empty() || Token::Match(tok->previous(), "[{,]") || Token::Match(tok->tokAt(-2), "%name% (")) {
833-
if (Token::Match(tok, "{ . %name% =|{")) {
833+
if (Token::Match(tok->tokAt(-1), "!!, { . %name% =|{")) {
834834
const int inArrayAssignment = state.inArrayAssignment;
835835
state.inArrayAssignment = 1;
836836
compileBinOp(tok, state, compileExpression);

Diff for: test/testtokenize.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -6634,6 +6634,7 @@ class TestTokenizer : public TestFixture {
66346634
ASSERT_EQUALS("double&(4[", testAst("void f(double(&)[4]) {}"));
66356635
ASSERT_EQUALS("voidu*", testAst("int* g ( void* (f) (void*), void* u);")); // #12475
66366636
ASSERT_EQUALS("f::(", testAst("::f();")); // #12544
6637+
ASSERT_EQUALS("(( (, f ({ (= (. c x) 0))))", testAst("f(c, { .x = 0 });", AstStyle::Z3)); // #12806
66376638
}
66386639

66396640
void asttemplate() { // uninstantiated templates will have <,>,etc..

0 commit comments

Comments
 (0)