You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This case is very awkward: we don't have anything good to key the lambda off when numbering. We can't use the function f because we can't refer to f without naming the lambda. Some options:
Use the <unqualified-name> (1f) but not the signature as part of the context when numbering the lambdas -- that would mean reordering multiple declarations of f (if it's overloaded) could result in a different overload getting the same mangling, but I think that's unavoidable here, if we don't want to mangle the body of the lambda.
Number such lambdas within the enclosing class. The risk of innocuous / unrelated changes altering a mangling of a different function would be higher with that approach, but it'd be simpler for implementations.
Assign some placeholder mangling for such lambdas, say UL. Then, if you used that placeholder in an <encoding>, enumerate the declarations in the class that have the same name in lexical order of first appearance, and mangle all of them. Number the declarations that have the same mangling, and append that numbering to the overall mangling of that name. (So we'd mangle the function called above as "the first template<typename, decltype((some lambda, 0))> void f() in C", and the function we didn't call would be mangled as "the second template<typename, decltype((some lambda, 0))> void f() in C".)
If an <encoding> would refer to a lambda that appears in a class body outside of the four contexts where we number lambdas, then mangle the function declaration as simply the name of the member function (with no function parameters) plus a discriminator, so the above are something like (for example) _ZN1C1fIiEE_ and _ZN1C1fIiEE0_.
I'm leaning towards (2) being the simplest thing, and probably good enough if people don't do this sort of thing very often. Note that all of these options are unstable under reordering of member functions within a class; they're just trading off which kinds of reordering result in mangled names changing / swapping.
The text was updated successfully, but these errors were encountered:
GCC mangles these as _ZN1C1fIiEEvPDTcltlNS_UlT_T_E_EELi1ELi2EEE and _ZN1C1fIiEEvPDTcltlNS_UlT_T_E0_EELi1ELi2EEE respectively, and generally appears to be following option (2). Note, however, that GCC mangles both the enclosing template parameter T and the lambda's implied template parameter for auto as T_, which seems wrong; I think these should actually be T_TL__.
Testcase:
This case is very awkward: we don't have anything good to key the lambda off when numbering. We can't use the function
f
because we can't refer tof
without naming the lambda. Some options:Use the <unqualified-name> (
1f
) but not the signature as part of the context when numbering the lambdas -- that would mean reordering multiple declarations off
(if it's overloaded) could result in a different overload getting the same mangling, but I think that's unavoidable here, if we don't want to mangle the body of the lambda.Number such lambdas within the enclosing class. The risk of innocuous / unrelated changes altering a mangling of a different function would be higher with that approach, but it'd be simpler for implementations.
Assign some placeholder mangling for such lambdas, say
UL
. Then, if you used that placeholder in an <encoding>, enumerate the declarations in the class that have the same name in lexical order of first appearance, and mangle all of them. Number the declarations that have the same mangling, and append that numbering to the overall mangling of that name. (So we'd mangle the function called above as "the firsttemplate<typename, decltype((some lambda, 0))> void f()
inC
", and the function we didn't call would be mangled as "the secondtemplate<typename, decltype((some lambda, 0))> void f()
inC
".)If an <encoding> would refer to a lambda that appears in a class body outside of the four contexts where we number lambdas, then mangle the function declaration as simply the name of the member function (with no function parameters) plus a discriminator, so the above are something like (for example)
_ZN1C1fIiEE_
and_ZN1C1fIiEE0_
.I'm leaning towards (2) being the simplest thing, and probably good enough if people don't do this sort of thing very often. Note that all of these options are unstable under reordering of member functions within a class; they're just trading off which kinds of reordering result in mangled names changing / swapping.
The text was updated successfully, but these errors were encountered: