-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix bug of using GenericParamList after it's std::move'd #62656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -4504,6 +4504,17 @@ class DeclDeserializer { | |||
|
|||
outerParams = genericParams; | |||
} | |||
#ifndef NDEBUG | |||
// Use outerParams before it will be moved with std::move(outerParams) | |||
unsigned paramCount = 0; |
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.
Is that crashing somewhere? I think that although this is makes when thinking about move semantics, this is not a problem in this case because outterParams
is a pointer GenericParamList *
and std::move
of a pointer like trivial types such as int
just defaults to copy so state of outerParams
is not changed. The question would be why would we std::move a pointer, but I guess the answer is to match ctx.evaluator.cacheOutput
signature with takes an r-value
of request result value...
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.
Is that crashing somewhere?
No, it's not.
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.
The question would be why would we std::move a pointer, but I guess the answer is to match
ctx.evaluator.cacheOutput
signature with takes anr-value
of request result value...
That's common case why std::move
is used.
What would you suggest? Should I close PR?
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.
Let's wait for @CodaFi feedback :)
paramList != nullptr; | ||
paramList = paramList->getOuterParameters()) { | ||
paramCount += paramList->size(); | ||
} | ||
assert(paramCount == |
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.
This assert should be moved as well, since it's the reason we're computing paramCount
here at all.
|
Should this PR be closed as irrelevant? |
No description provided.