File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ void CheckBool::checkBitwiseOnBoolean()
113113 continue ;
114114 const bool isBoolOp1 = astIsBool (tok->astOperand1 ());
115115 const bool isBoolOp2 = astIsBool (tok->astOperand2 ());
116+ if (!tok->astOperand1 ()->valueType () || !tok->astOperand2 ()->valueType ())
117+ continue ;
116118 if (!(isBoolOp1 || isBoolOp2))
117119 continue ;
118120 if (isCompound && (!isBoolOp1 || isBoolOp2))
Original file line number Diff line number Diff line change @@ -954,6 +954,16 @@ class TestBool : public TestFixture {
954954 " return b;\n "
955955 " }\n " );
956956 ASSERT_EQUALS (" " , errout.str ());
957+
958+ check (" struct S { bool b{}; };\n " // #12455
959+ " void f(const std::unordered_map<int, S> m) {\n "
960+ " for (const auto& e : m) {\n "
961+ " S s;\n "
962+ " s.b |= e.second.b;\n "
963+ " (void)s.b;\n "
964+ " }\n "
965+ " }\n " );
966+ ASSERT_EQUALS (" " , errout.str ());
957967 }
958968
959969 void incrementBoolean () {
You can’t perform that action at this time.
0 commit comments