From 544ec38ca98bbb713272c46b7e8eaf7c2f8d3d53 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:55:45 +0200 Subject: [PATCH] Add test for #2490 (#4551) --- test/testcondition.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 6bf65a0ab..d35474d91 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -5482,6 +5482,13 @@ private: " if (p=foo()){}\n" "}"); ASSERT_EQUALS("", errout.str()); + + check("void f(uint32_t u) {\n" // #2490 + " if ((u = 0x00000000) || (u = 0xffffffff)) {}\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:2]: (style) Condition 'u=0x00000000' is always false\n" + "[test.cpp:2]: (style) Condition 'u=0xffffffff' is always true\n", + errout.str()); } void compareOutOfTypeRange() {