Fix FP returnTempReference#4793
Merged
orbitcowboy merged 6 commits intocppcheck-opensource:mainfrom Feb 17, 2023
Merged
Conversation
pfultz2
reviewed
Feb 14, 2023
| if (var.nameToken()) | ||
| valuetype.bits = var.nameToken()->bits(); | ||
| valuetype.pointer = (var.valueType() && var.valueType()->container) ? 0 : var.dimensions().size(); | ||
| valuetype.pointer = (var.valueType() && var.valueType()->container && Token::simpleMatch(var.typeStartToken(), "std :: array")) ? 0 : var.dimensions().size(); |
Contributor
There was a problem hiding this comment.
What about std::array<int, 4> x[2]? That should be a pointer.
Collaborator
Author
There was a problem hiding this comment.
That line was added in 271ccbc
For std::array<int, 4> x[2], there is no information about the C array (size 2) available in ValueType. var.dimensions() stores the std::array size 4, so we used to set pointer to 1 by accident.
It's almost like we shouldn't have mashed pointers, arrays, and std::arrays together in the first place...
Contributor
There was a problem hiding this comment.
Yea I agree. I assume there is no issue with boost::array since we don't treat it like a C array.
pfultz2
approved these changes
Feb 16, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.