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.
[cxx-interop] Support function templates. #33053
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
[cxx-interop] Support function templates. #33053
Changes from all commits
b2b6b05
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@varungandhi-apple can I get your opinion on error handling again here? The issue is, on Windows, clang will crash if we don't exit here (because of an assertion:
TPL->size() == TemplateArgs.size() && "size mismatch between args and parms!"
). That's only on Windows, though. On other platforms, we're allowed to continue which I think is good because it allows us to report more errors before aborting compilation. I see a few paths forward, what do you think would be the best (others, please feel free to chime in as well)?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.
[I only briefly skimmed the Clang code...] The assertion you pointed out is in
MicrosoftCXXNameMangler::mangleTemplateArgs
. I don't understand why the name mangler is being called upon template instantiation. That seems strange... shouldn't name mangling happen much later in the pipeline? I would expect that if there's an instantiation error, and I hope there is one when there's a size mismatch, we won't even get to the name mangler.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.
Thanks, your comment made me realize, I think the issue is completely my fault. What we need to do is return
nullptr
after emitting the diagnostic. I think that will fix this.I think name mangling probably happens when we try to instantiate the function template.
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.
Ah. That's not what I was talking about (and I totally missed that we didn't return here in case of an error)... but glad that it helped you figured out the issue. 😅
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.
All is well that ends well :) Now let's just hope the build succeeds on Windows.