This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/56973 (DR 696), lambda capture of const variables


On Thu, Sep 28, 2017 at 3:38 PM, Jason Merrill <jason@redhat.com> wrote:
> The G++ lambda implementation previously implemented an early
> tentative resolution of DR 696, whereby mentions of an outer constant
> variable would immediately decay to the constant value of that
> variable.  But the final resolution specified that we should capture
> or not depending on how the variable is used: if we use it as an
> lvalue, it's captured; if we use it as an rvalue, it isn't.
>
> The first patch is some minor fixes discovered during this work.
> The second patch reworks how we find capture proxies to use
> local_specializations instead of name lookup.
> The third patch delays capture of constant variables until
> mark_rvalue_use/mark_lvalue_use.
>
> The third patch also adds calls to mark_*_use in a couple of places
> that needed it; I expect more will be necessary as well.

I tested using delayed capture for all variables, and these fixes are
the result.

The first two patches are fixes for generic issues that I came across
while looking at the capture issues.  The first adds checking within a
template definition for non-dependent return statements.  The second
fixes a few small issues.  The third patch implements generic lambda
capture in dependent full-expressions, and the fourth adds some
missing mark_*_use calls and fixes other issues with delayed capture.

Tested x86_64-pc-linux-gnu, applying to trunk.

Attachment: nd-return.diff
Description: Text document

Attachment: misc.diff
Description: Text document

Attachment: dep-cap.diff
Description: Text document

Attachment: cap-fix.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]