[cxx-abi-dev] Decltype mangling and type dependency

David Vandevoorde daveed at edg.com
Wed Jun 23 15:29:37 UTC 2010


On Jun 22, 2010, at 10:12 PM, Jason Merrill wrote:

> On 06/22/2010 03:34 PM, David Vandevoorde wrote:
>> I thought we (the C++ committee) deliberately did _not_ put access control under SFINAE?
> 
> Yes, but I think this was a mistake which adds a lot of complexity to libraries, as people need to hack around it with cumbersome traits.  I recently brought this up under "SFINAE and access control" on the core reflector.
> 
>>> >  template <class U> decltype (a.i) f() { } // #1
>>> >  template <class U> decltype (b.i) f() { } // #2
>> This (#2) declaration is invalid because it's a redeclaration of #1.  (And if they weren't they'd have distinct signatures.)
> 
> Right, either they're the same function or they have distinct signatures.  I was arguing that they aren't the same function, so they need to have distinct signatures, so we shouldn't fold decltype(a.i) to int.
> 
> But I am leery of trying to define a whole new kind of dependency to deal with this, so I guess I'm content to decide that these are the same function because a.i is not value-dependent or type-dependent--and that these functions wouldn't be subject to the hypothetical access-SFINAE because the access doesn't arise from a substitution.


Thanks: Our reasoning/opinions may differ, but the conclusion is the same.  So I'll work on wording for that.

Regarding the following case you and Mike Herrick have discussed:

	template<class T> auto f(T p)->decltype(p);

The encoding of decltype(p) could use the Dt/DT codes or the underlying type (T_).  The latter, however, requires a special case in the spec: Is it worth it, and if so, where should the line be drawn (any identifier with a dependent type? only identifiers with a template parameter type? something else?)?  (My own preference is not to have a special case, but that would require a change in the g++ implementation.)

	Daveed




More information about the cxx-abi-dev mailing list