-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #9157 False negative: stlOutOfBounds, cast (#7233)
- Loading branch information
1 parent
b7d2a04
commit 841baa3
Showing
3 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
841baa3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrchr-github I see problems caused by this. I would prefer that we don't set isCast for variable declarations. See:
https://trac.cppcheck.net/ticket/13579
841baa3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I revert this commit with #7254 please feel free to make a new attempt and consider the problem in 13579 then..
841baa3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
however I would like some test in TestTokenizer or TestSymbolDatabase that checks that the
Token::isCast
is set properly. The TestStl test does not test that explicitly and it could be possible to change the isCast in the future and maybe this test would still succeed..however I feel it's also questionable if this is a cast
int(expr)
is that what the specification says? I would guess that it's a constructor call?841baa3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional-style casts are explicit type conversions, the same as regular c-style casts:
https://en.cppreference.com/w/cpp/language/explicit_cast