[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type

Aaron H Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 13:06:20 PDT 2022


AaronLiu added a comment.

In D119136#3465522 <https://reviews.llvm.org/D119136#3465522>, @cor3ntin wrote:

> In D119136#3465361 <https://reviews.llvm.org/D119136#3465361>, @AaronLiu wrote:
>
>> When compile the following valid testcase:
>>
>>   void foo()
>>   {
>>           int x = [x](int y[sizeof x]){return sizeof x;}(0);
>>   }
>>
>> It will complain:
>>
>>   error: captured variable 'x' cannot appear here
>>           int x = [x](int y[sizeof x]){return sizeof x;}(0);
>>                                    ^
>>
>> The issue is also described in: https://cplusplus.github.io/CWG/issues/2569.html
>
> Is that something you encountered in existing code, or where you trying to write test against this change.
> I only implemented the `decltype` part of the proposed resolution, for reason explained in that link (supporting `sizeof(unqual-id)` and `noexcept(unqual-id) seems extremely arbitrary).
> But hopefully WG21 will come up with a more encompassing fix before we attempt to re-land this change

It is reduced from the existing code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119136/new/

https://reviews.llvm.org/D119136



More information about the cfe-commits mailing list