Fix invoke call on Clang (possibly a compiler bug) #1225
Merged
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.
For unknown reasons, Clang resolves the
invoke
call (inwinrt::impl::promise_base::Completed
andwinrt::impl::promise_base::set_completed
) tostd::invoke
instead ofwinrt::impl::invoke
, which breaks exception handling and causes some disconnected.cpp tests to crash. After changing the call to specify the namespace, 4 more tests indisconnected.cpp
now passes on Clang.To demonstrate the issue, I modified the generated
winrt/Windows::Foundation.h
and duplicated line 3765 (winrt::impl::promise_base::set_completed
), and changed it so that one call specifies the namespace and the other doesn't. The disassembly shows how the name resolution of the two calls differ (this is with clang+mingw but the same happens with clang+msvc):