-
Notifications
You must be signed in to change notification settings - Fork 96
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
New mangling rule for deduced default template arguments. #184
Comments
Mangling an adjustment on the template argument seems like the right approach. That particular suggestion seems likely to cause problems because of how it separates the template-name from the template-arguments and just drops an arbitrary numeral into the mangling, but we can surely come up with something. I believe we already specify an adjustment for changing template signatures for template template arguments; it's possible that that would be sufficient here, or maybe we need to be more explicit about the deduction. |
Is this about #166, wrt the template-param-decl production? |
Yes. Thanks for reminding me that I need to put some effort into landing that in the spec. |
It seems that could work, but it needs to be extended to encode default arguments as well. Though it seems this could already be required for the proposed resolution of https://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1286 |
As part of https://isocpp.org/files/papers/P3310R0.html, we would like to introduce deduction of default template arguments.
When deducing a template template parameter from a template specialization, we propose to default any extra arguments the parameter side would not consume, thus effectively allowing a template template parameter to bind to a template declaration with less template parameters, even if the extra parameters aren't declared as defaulted in the template declaration.
Consider:
Since 'f' specialized from
A<int, float>
is different from 'f' specialized fromA<int, double>
, this will affect mangling and so we need new rules.This should only affect template template arguments.
A class template specialization
A<int, double>
which was specialized as written, is still the same class when specialized from a template template parameter bound toA
deduced from a different specialization.I would like guidance with such a rule.
My initial idea would be that when mangling such a template template argument, we follow the template name with a number, which is a starting position from which the first argument is deduced, followed by the same mangling we currently use for a template argument list.
Thus:
This 'f' specialized with
A<int, double>
would be mangled as_Z1fITtTyE1A1IdEEvT_IiE
.The text was updated successfully, but these errors were encountered: