[PATCH] D122768: [Clang][C++20] Support capturing structured bindings in lambdas
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 13:51:11 PDT 2022
cor3ntin added a comment.
In D122768#3700738 <https://reviews.llvm.org/D122768#3700738>, @aeubanks wrote:
> In D122768#3700486 <https://reviews.llvm.org/D122768#3700486>, @cor3ntin wrote:
>
>> In D122768#3700451 <https://reviews.llvm.org/D122768#3700451>, @aeubanks wrote:
>>
>>> in the commit message
>>>
>>> In addition, capturing an anonymous union member,
>>> a bitfield, or a structured binding thereof now has a
>>> better diagnostic.
>>>
>>> "better diagnostic" implies there was already a diagnostic, but we're seeing new errors pop up. is this just a not precise commit message or are new errors related to capturing bitfields by reference unintentional?
>>
>> New errors when capturing bit fields are probably*not* intentional. You have some of the problematic code i could look at? (not that the patch was reverted and then re-landed to fix a bug there)
>> And... the commit message is a bit inaccurate as the change that was supposedly improving diagnostics for reference to bit fields was remove (and i forgot to update the commit message accordingly)
>
> reduced, this does seem wrong
>
> $ cat /tmp/a.cc
> struct S {
> int s : 4;
> };
>
> void f() {
> S s;
> int l = s.s;
> auto a = [&]() {
> l;
> };
> }
> $ clang++ -fsyntax-only /tmp/a.cc
> /tmp/a.cc:10:3: error: cannot capture a bit-field by reference
> l;
> ^
> /tmp/a.cc:8:6: note: 'l' declared here
> int l = s.s;
> ^
> /tmp/a.cc:3:6: note: bit-field is declared here
> int s : 4;
> ^
> 1 error generated.
Thanks a lot for that, I confirmed the issue.
I will land a fix shortly
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122768/new/
https://reviews.llvm.org/D122768
More information about the cfe-commits
mailing list