[cxx-abi-dev] Mangling C++0x Lambdas

David Vandevoorde daveed at edg.com
Wed Dec 17 18:01:41 UTC 2008


On Dec 17, 2008, at 12:48 PM, David Vandevoorde wrote:

>
> On Dec 17, 2008, at 12:05 PM, Doug Gregor wrote:
> [...]
>> Ah, right. Well, decltype will surely get us into trouble:
>>
>> template<typename Lambda> struct Y { };
>>
>> Y<decltype([](int x) -> int { return x; })> y;
>
>
> Having thought about that some more... I think that cannot be  
> matched across translation units either.
>
> I.e., every occurrence of a lambda has a different type.  E.g.:
>
>  template<typename Lambda> struct Y { };
>  extern Y<decltype([](int x) -> int { return x; })> y;  // Okay,  
> but...
>  Y<decltype([](int x) -> int { return x; })> y;         // Error:  
> not redeclared with the same type.


And I think that principle would cover all nonlocal uses of lambdas  
that require mangling.  I.e., it sufficient that those be mangled  
uniquely; reproducibility is not required (and therefore not really an  
ABI issue).

Have I got that right?

	Daveed




More information about the cxx-abi-dev mailing list