Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ static bool compareKnownValue(const Token * const tok1, const Token * const tok2
if (v1 == tok1->values().end()) {
return false;
}
if (v1->isNonValue() || v1->isContainerSizeValue() || v1->isSymbolicValue())
if (v1->isNonValue() || v1->isContainerSizeValue() || v1->isBufferSizeValue() || v1->isSymbolicValue())
return false;
const auto v2 = std::find_if(tok2->values().cbegin(), tok2->values().cend(), isKnownFn);
if (v2 == tok2->values().end()) {
Expand Down
12 changes: 12 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8203,6 +8203,18 @@ class TestOther : public TestFixture {
" return (x >= 0.0) ? 0.0 : -0.0;\n"
"}\n");
ASSERT_EQUALS("", errout_str());

check("struct A {};\n" // # 14300
"struct B {};\n"
"void f(bool x) {\n"
" A* a = new A();\n"
" B* b = new B();\n"
" auto p = x ? static_cast<void*>(a) : static_cast<void*>(b);\n"
" (void)p;\n"
" delete a;\n"
" delete b;\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void duplicateValueTernarySizeof() { // #13773
Expand Down
Loading