-
Notifications
You must be signed in to change notification settings - Fork 85
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
mangling of lambdas for inline variables #94
Comments
The mangling grammar often uses The specification usually uses terms from the standard when it can. When these prefixes only arose from data members (or, well, only arose in an ABI-affecting way), |
The mangling rule here is also missing at least one case:
... has no mangling for the lambda. The reason is that the only place we accept a <data-member-prefix> is after another <prefix>. Clang and GCC disagree on how to mangle this; GCC uses I think we're missing a <prefix> production:
|
We also have a problem with substitutions. Given:
I think the GNU demangler treating The LLVM demangler seems to most closely be following the ABI rule, as does ICC if you ignore the spurious namespace. Should we update Clang and GCC to match, or change the ABI rule to say that a <data-member-prefix> is not a substitutable entity? I expect the ABI risk of making a change here is pretty small. |
While we're here: it would be convenient for the <data-member-prefix> mangling to also cover structured bindings (even though I don't think there's any way currently for a lambda in a structured binding's initializer to be ABI-relevant). I'd suggest:
|
Extend grammar to cover additional contexts where this can be used. Fixes itanium-cxx-abi#94.
Also: should we treat the template-name in a data-member-prefix that names a variable template specialization as a substitutable entity? Currently we don't do so. |
Extend grammar to cover additional contexts where this can be used. Fixes itanium-cxx-abi#94.
Hmm. Variable template names probably ought to be substitutable, yeah. We can probably still get away with that. I agree with all of your proposed changes. |
Given the resolution of DR2300 inline variables intialized to lambda need to uniquely identify the lambda across translation units.
The document does describe this (#closure-types), but I find the wording confusing as it focusses on static data members. I hit an issue with namespace-scope variables:
inline auto bob = []{};
The grammar has:
<data-member-prefix> ::= <member source-name> [<template-args>] M
'<member source-name>' appears nowhere else in the document. I think just '<source-name>' would suffice.
It would also be less confusing if '>data-member-prefix<' changed to '<data-prefix>', it's used in on place in the <prefix> reduction.
The text was updated successfully, but these errors were encountered: