Skip to content

Fix #13877 FP constParameterReference when casting to derived class#8041

Merged
chrchr-github merged 3 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_13877
Jan 2, 2026
Merged

Fix #13877 FP constParameterReference when casting to derived class#8041
chrchr-github merged 3 commits intocppcheck-opensource:mainfrom
chrchr-github:chr_13877

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

@chrchr-github chrchr-github added the merge-after-next-release Wait with merging this PR until after the next Release label Dec 17, 2025
Comment thread lib/astutils.cpp
auto expr = getExprTok();
if (!expr && !(tok->valueType() && tok->valueType()->pointer == 0 && tok->valueType()->reference == Reference::None))
aliased = true;
if (!aliased && expr && expr->varId() && tok->isCast() && tok->valueType() && tok->valueType()->reference != Reference::None &&
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move this condition into isAliasOf?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, isAliasOf() currently only relies on ValueFlow. @pfultz2
We have some more FPs related to this logic.

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion about isAliasOf. If it just works and makes isAliasOf better.. then I like the idea.

Feel free to merge if you want.

@chrchr-github chrchr-github merged commit 269c636 into cppcheck-opensource:main Jan 2, 2026
55 checks passed
@chrchr-github chrchr-github deleted the chr_13877 branch January 2, 2026 14:28
@chrchr-github
Copy link
Copy Markdown
Collaborator Author

@danmar It looks like daca is down again. Could you please check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-after-next-release Wait with merging this PR until after the next Release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants