The new variables in winrt::impl::consume_ methods can collide with parameters to that method #1455
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.
Why is this change being made?
@DefaultRyan discovered a subtle compatibility issue with the cast result checking changes and certain projected methods. The variables in the consume_ method, such as the generically-named
code
variable, can shadow the parameters to the function. This led to a build break where a function took an int16_t namedcode
and that was shadowed by theint32_t
namedcode
with the HRESULT in it. Fortunately the compiler had our back and flagged the size truncation as a build break so it was noticed.Briefly summarize what changed
The variable names in these generated functions are now much uglier (and therefore less likely to collide by coincidence). They have an underscore prefix and then lowercase which should put them into an unofficial namespace that shouldn't collide with anything else. The
code
variable is now named_winrt_cast_result_code
for example. While I was renaming everything I realized that my previous names mismatched the cppwinrt naming convention of snake_case so I fixed them up.How was this change tested?
build_test_all.cmd
passed.Here is the new code gen for Windows::Foundation::ToString()