-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
ms mangler for template values: poor nyi error messages and nyi opte pointer #97756
Comments
@llvm/issue-subscribers-clang-frontend Author: None (memory-thrasher)
## I am reporting this bug for completeness. I am actively working on a patch submission.
The official MSVC mangler lacks support for some c++ that is valid according to the standard, clang, and every decent compiler. Concerning template instance name mangling, specifically, there are presently 6 cases where the function MicrosoftCXXNameMangler::mangleTemplateArgValue gives up mangling and emits the rather unhelpful error: I improved that error message on my local build to tell which of the 6 possible cases I was running into. That case is when the non-type template parameter's value is an l-value point to one-past-the-end of some constexpr array. This case is not possible in c++ code that supports the official MSVC compiler, so consistency with MSVC is both impossible and uneeded. Furthermore, templates are not generally called across an ABI boudnary, but rather, each binary contains its own instances. I arbitrarily chose a mangling pseudonym to represent this case. I foresee two potential future issues, though both seem to me to be highly unlikely and neither, any worse than failing to compile the code in the first place.
The patch will include a minimal test case. |
A minimal test case would be helpful for the issue report as well. |
Here you go. Maybe not quite minimal but I wanted to make the usefulness when it works also apparent. Host system is ubuntu 22.04 so the default target uses itanium mangler. It's cross-compiling to msvc/windows that's broken. |
For reference we were discussing this here: #94650. While is this mostly true the original intention, afaik, is that In general I do agree especially in your example that if clang has a custom mangling it probably will never be noticed in debug builds and in release builds where it will most likely be inlined. However if any of these methods have static locals then multiple definitions across objects built with msvc vs clang isn't ideal. I am writing up a discourse to get consensus on this as was discussed in #94650. Hopefully that goes up sometime tomorrow but I am fairly certain the outcome will be |
…to handle template argument values that are pointers one-past-the-end of a non-array symbol. Also improves error messages in other template argument scenarios where clang bails. #97756 I don't think I hooked up the unit test right. I'm not sure one is really needed for what boils down to a tweaked if statement. Please advise.
verified working on trunc after that pr was merged. |
Summary: …to handle template argument values that are pointers one-past-the-end of a non-array symbol. Also improves error messages in other template argument scenarios where clang bails. #97756 I don't think I hooked up the unit test right. I'm not sure one is really needed for what boils down to a tweaked if statement. Please advise. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250712
I am reporting this bug for completeness. I am actively working on a patch submission.
The official MSVC mangler lacks support for some c++ that is valid according to the standard, clang, and every decent compiler. Concerning template instance name mangling, specifically, there are presently 6 cases where the function MicrosoftCXXNameMangler::mangleTemplateArgValue gives up mangling and emits the rather unhelpful error:
I improved that error message on my local build to tell which of the 6 possible cases I was running into. That case is when the non-type template parameter's value is an l-value point to one-past-the-end of some constexpr array. This case is not possible in c++ code that supports the official MSVC compiler, so consistency with MSVC is both impossible and uneeded. Furthermore, templates are not generally called across an ABI boudnary, but rather, each binary contains its own instances.
I arbitrarily chose a mangling pseudonym to represent this case. I foresee two potential future issues, though both seem to me to be highly unlikely and neither, any worse than failing to compile the code in the first place.
The patch will include a minimal test case.
The text was updated successfully, but these errors were encountered: