File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5109,6 +5109,22 @@ class TestCondition : public TestFixture {
51095109 " [test.cpp:7:11]: (style) Condition 'i==a.x' is always true [knownConditionTrueFalse]\n "
51105110 " [test.cpp:8:11]: (style) Condition 'j==a.x' is always true [knownConditionTrueFalse]\n " ,
51115111 errout_str ());
5112+
5113+ check (" struct S { int i; };\n " // #12795
5114+ " struct T {\n "
5115+ " std::map<std::string, S*> m;\n "
5116+ " S* get(const std::string& s) { return m[s]; }\n "
5117+ " void modify() { for (const auto& e : m) e.second->i = 0; }\n "
5118+ " };\n "
5119+ " void f(T& t) {\n "
5120+ " const S* p = t.get(\" abc\" );\n "
5121+ " const int o = p->i;\n "
5122+ " t.modify();\n "
5123+ " if (p->i == o) {}\n "
5124+ " }\n " );
5125+ TODO_ASSERT_EQUALS (" " ,
5126+ " [test.cpp:11:14]: (style) Condition 'p->i==o' is always true [knownConditionTrueFalse]\n " ,
5127+ errout_str ());
51125128 }
51135129
51145130 void alwaysTrueInfer () {
You can’t perform that action at this time.
0 commit comments