Skip to content

Commit abfa598

Browse files
committed
Fix #14287 Crash in valueFlowSymbolic() with initializer list
1 parent 9ab1585 commit abfa598

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

lib/valueflow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,8 @@ static const Token* skipCVRefs(const Token* tok, const Token* endTok)
19681968

19691969
static bool isNotEqual(std::pair<const Token*, const Token*> x, std::pair<const Token*, const Token*> y)
19701970
{
1971+
if (x == y)
1972+
return false;
19711973
const Token* start1 = x.first;
19721974
const Token* start2 = y.first;
19731975
if (start1 == nullptr || start2 == nullptr)

test/testvalueflow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7990,6 +7990,12 @@ class TestValueFlow : public TestFixture {
79907990
"};\n"
79917991
"U<S*> u;\n";
79927992
(void)valueOfTok(code, "new");
7993+
7994+
code = "void f() {\n"
7995+
" auto a = { \"1\" };\n"
7996+
" auto b = a;\n"
7997+
"}\n";
7998+
(void)valueOfTok(code, "b");
79937999
}
79948000

79958001
void valueFlowHang() {

0 commit comments

Comments
 (0)