Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 8 additions & 2 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11935,9 +11935,9 @@ class TestOther : public TestFixture {
// TODO: only used in a single place
#define checkCustomSettings(...) checkCustomSettings_(__FILE__, __LINE__, __VA_ARGS__)
template<size_t size>
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..
Expand Down Expand Up @@ -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() {
Expand Down
Loading