[cxx-abi-dev] Mangling sizeof

Doug Gregor doug.gregor at gmail.com
Mon Mar 9 16:31:37 UTC 2009


On Mon, Mar 9, 2009 at 8:29 AM, John H. Spicer <jhs at edg.com> wrote:
>
> On Mar 9, 2009, at 11:21 AM, Doug Gregor wrote:
>
>> On Sun, Mar 8, 2009 at 12:32 PM, John H. Spicer <jhs at edg.com> wrote:
>>>
>>>
>>> Is there any reason not to just say that doing substitution on an lambda
>>> expression results in a substitution failure?
>>
>> Implementation cost, for one. We currently have to be able to recover
>> from a substitution failure in any expression or type. If we say that
>> substitution into a lambda cannot result in a hard error, it means
>> that we have to be able to recover from substitution failures in any
>> statement that occurs in the lambda.
>>
>
> No, what I'm saying is that you never actually attempt the substitution.
> If you encounter a lambda expression when doing substitution you just always
> fail.

Oh. So a function template like, e.g.,

  template<typename T> void f(A<sizeof([](int) { return 0; })> *a = 0);

could never be instantiated or invoked. In that case, I'd rather just
ban the use of lambdas in sizeof and decltype. Issue 766 deals with
this, and a favorable resolution there could make this
mangling-the-body-of-a-lambda issue go away.

  - Doug



More information about the cxx-abi-dev mailing list