[PATCH v2] c++, contracts: No implicit capture in lambda contract assertions [PR124648].

Iain Sandoe iains.gcc@gmail.com
Wed Apr 8 09:37:28 GMT 2026


Apologies all, I attached the wrong patch to this response

> On 8 Apr 2026, at 15:02, Iain Sandoe <iains.gcc@gmail.com> wrote:
> 
> Hi Marek,
> 
>>> +  if (current_class_ref && !CP_TYPE_CONST_P (TREE_TYPE (current_class_ref)))
>>> +    current_class_ref = view_as_const (current_class_ref);
> 
>> This change makes current_class_ref_copy unused.  Looks like this function
>> is missing the
>> 
>> /* Revert (any) constification of the current class object.  */
>> current_class_ref = current_class_ref_copy;
>> 
>> but there's
>> 
>> current_class_ref = saved_ccr;
>> 
>> below so I guess current_class_ref_copy can be removed.
> 
> Yes, done.
> 
>> Can we move the !CP_TYPE_CONST_P check into view_as_const instead?
> 
> Yeah that's a much better place for it, done as attached,
> 
> Retested on x86_64-darwin and powerpc64le-linux,
> OK for trunk, when?
> thanks
> Iain

here is the correct one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-c-contracts-Omit-unnecessary-const-wrappers.patch
Type: application/octet-stream
Size: 3197 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20260408/1bb97ee4/attachment.obj>


More information about the Gcc-patches mailing list