From e9e3755dba57be0a470b0e949ab87366b5f0b56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Mon, 2 Feb 2026 14:17:35 +0100 Subject: [PATCH 1/2] Add test --- test/testother.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/testother.cpp b/test/testother.cpp index 55fbe3830f1..0cfa173faf6 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -11935,9 +11935,9 @@ class TestOther : public TestFixture { // TODO: only used in a single place #define checkCustomSettings(...) checkCustomSettings_(__FILE__, __LINE__, __VA_ARGS__) template - void checkCustomSettings_(const char* file, int line, const char (&code)[size], const Settings& settings) { + void checkCustomSettings_(const char* file, int line, const char (&code)[size], const Settings& settings, bool cpp = true) { // Tokenize.. - SimpleTokenizer tokenizer(settings, *this); + SimpleTokenizer tokenizer(settings, *this, cpp); ASSERT_LOC(tokenizer.tokenize(code), file, line); // Check.. @@ -12010,6 +12010,12 @@ class TestOther : public TestFixture { " i = i++ + 2;\n" "}", settings11); ASSERT_EQUALS("[test.cpp:2:11]: (error) Expression 'i+++2' depends on order of evaluation of side effects [unknownEvaluationOrder]\n", errout_str()); + + // #14431 + checkCustomSettings("int f(void) {\n" + " struct baz baz = {.bar = {.foo = {.foo = 1}}};\n" + "}\n", settings0, false); + ASSERT_EQUALS("", errout_str()); } void testEvaluationOrderSelfAssignment() { From cfaca681f2caefc58268237df72d290cff6c58e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Mon, 2 Feb 2026 14:12:53 +0100 Subject: [PATCH 2/2] Fix #14431 --- lib/checkother.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 979ea4ffdad..3b8cb899248 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -3794,6 +3794,8 @@ void CheckOther::checkEvaluationOrder() continue; if (!tok->astOperand1()) continue; + if (tok->astOperand1()->str() == "." && !tok->astOperand1()->astOperand2()) + continue; for (const Token *tok2 = tok;; tok2 = tok2->astParent()) { // If ast parent is a sequence point then break const Token * const parent = tok2->astParent();