C++: Fix "Overloaded assignment does not return 'this'" for templates#608
Merged
Conversation
The added test is a reduced version of a FP observed in the wild.
Adding this call to `getUnspecifiedType` makes the error message better in the presence of typedefs and qualifiers on an assignment operator return type. It's also needed to avoid losing valid results in the commit that comes after this.
geoffw0
previously approved these changes
Dec 4, 2018
Contributor
geoffw0
left a comment
There was a problem hiding this comment.
Changes and tests LGTM. Fixes the boost FP and a couple of others.
Should this have a change note?
Contributor
Author
|
The change note is covered by https://github.com/Semmle/ql/pull/589/files#diff-905cdad247740ff1bf32df4e1b754b7aR31 |
Contributor
Author
|
I forgot to edit the comments in the test in the last commit. I'll just do that and rebase. |
These type checks were overlapping with `assignOperatorWithWrongType` is are no longer needed now that `assignOperatorWithWrongType` is improved. They were causing FPs and misleading error messages on uninstantiated templates.
4d1991a to
6239455
Compare
geoffw0
approved these changes
Dec 4, 2018
Contributor
geoffw0
left a comment
There was a problem hiding this comment.
👍
I've tested this on a wider variety of projects now, boost is the only one where I saw changes.
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.
My last commit in #362 introduced FPs in code where
operator=is a template with a dependent return type.I've tested for performance and correctness on Boost and Blender.