From 59cf0ba04c15c271216c63b0613885c6cf797350 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Sun, 21 Jul 2024 11:50:56 +0200 Subject: [PATCH] Add test for #12391 --- test/testcondition.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 953b0e81c85..4cf145288c5 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -5678,6 +5678,15 @@ class TestCondition : public TestFixture { "}\n"); ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) The if condition is the same as the previous if condition\n", errout_str()); + check("struct S { int x; };\n" // #12391 + "int f(const struct S* a, const struct S* b) {\n" + " const struct S* p = b;\n" + " if (a->x < p->x) p++;\n" + " if (a->x < p->x) p++;\n" + " return p->x;\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); + // do not crash check("void assign(const MMA& other) {\n" " if (mPA.cols != other.mPA.cols || mPA.rows != other.mPA.rows)\n"