[cxx-abi-dev] Missing mangling of elaborated type specifiers
John McCall
rjmccall at apple.com
Wed Mar 26 19:54:40 UTC 2014
On Mar 26, 2014, at 12:23 PM, Richard Smith <richardsmith at google.com> wrote:
> On 26 March 2014 11:59, John McCall <rjmccall at apple.com> wrote:
> Sorry, what? Why are any of these the same function template under the ODR?
> template <class T> auto f() -> enum T::type;
> template <class T> auto f() -> struct T::type;
> template <class T> auto f() -> typename T::type;
> Template argument deduction can distinguish the first two (and drop them in favor of the third for typedef members), and the third can be introduced later or in a different translation unit.
>
> The first two are not the same function template. But that doesn't matter, as far as I can see -- we don't have mangled names for function templates, we have mangled names for function template specializations, and there cannot exist template arguments for which substitution into the first two function templates both succeed.
Ah, good point. Still, let’s not make too many unnecessary assumptions here — there are certainly plausible paths forward for both the language (function template templates parameters) and tooling (indexers, ODR checkers) that would benefit from being able to distinguish entities along ODR lines. And this is C++, so there may be some evil way to make this happen that we simply haven’t thought of yet. The fewer pitfalls we make for ourselves, the better.
> I don’t think distinguishing struct and class is worth it.
>
> I agree that the benefit of a demangler being able to say whether it's got a class or struct is marginal. Maybe drop the 'TC' mangling and keep the other three?
Sounds good to me.
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20140326/86272e6a/attachment.html>
More information about the cxx-abi-dev
mailing list