On Mar 26, 2014, at 12:23 PM, Richard Smith <[email protected]> wrote:
> On 26 March 2014 11:59, John McCall <[email protected]> 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.
_______________________________________________
cxx-abi-dev mailing list
[email protected]
http://sourcerytools.com/cgi-bin/mailman/listinfo/cxx-abi-dev

Reply via email to