File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -706,6 +706,7 @@ namespace ValueFlow
706706 else if (Token::Match (parent, " :: %name%" ) && parent->astOperand2 () == tok) {
707707 setTokenValue (parent, std::move (value), settings);
708708 }
709+
709710 // Calling std::size or std::empty on an array
710711 else if (value.isTokValue () && Token::simpleMatch (value.tokvalue , " {" ) && tok->variable () &&
711712 tok->variable ()->isArray () && Token::Match (parent->previous (), " %name% (" ) && astIsRHS (tok)) {
@@ -724,5 +725,10 @@ namespace ValueFlow
724725 }
725726 }
726727 }
728+
729+ // C++ constructor
730+ else if (value.isIntValue () && parent->str () == " {" && parent->valueType () && (parent->valueType ()->isIntegral () || parent->valueType ()->pointer > 0 )) {
731+ setTokenValue (parent, std::move (value), settings);
732+ }
727733 }
728734}
Original file line number Diff line number Diff line change @@ -587,6 +587,8 @@ class TestValueFlow : public TestFixture {
587587 " void foo() { x = N::e1; }" ;
588588 ASSERT_EQUALS (1 , valueOfTok (code, " ::" ).intvalue );
589589 }
590+
591+ ASSERT_EQUALS (63 , valueOfTok (" x = 3 * uint32_t{21};" , " *" ).intvalue );
590592 }
591593
592594 void valueFlowString () {
You can’t perform that action at this time.
0 commit comments