C++ Logo

std-proposals

Advanced search

Re: [std-proposals] sizeof lambda in an unevaluated context

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 24 Jun 2024 17:06:55 -0700
On Monday 24 June 2024 15:54:35 GMT-7 Frederick Virchanza Gotham via Std-
Proposals wrote:
> If we are allowed since C++20 to have lambdas in unevaluated contexts,
> then does it make sense to introduce a few new restrictions? Such as:
> (1) The size of two lambda types that have the same captures shall
> be the same
> (2) The alignment of two lambda types that have the same captures
> shall be the same

No, I don't think it's necessary. Because they are different closure types,
anyone using them must be prepared to deal with types that may have different
captures so it doesn't matter whether they have the same size and alignment or
not. The rules above add unnecessary complexity to the standard.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-06-25 00:07:01