[Jiří Paleček] [PATCH][C++] Fix constant reference in a lambda (PR c++/53488)

2012-08-27 Thread Dodji Seketeli
Let's CC Jason. --- Begin Message --- Hello, I've been investigating a bug in gcc I came across recently and after some difficulties, I have produced a patch that actually fixes that behavior. However, I don't think the patch is very good and I would really appreciate your help in making i

Re: [Jiří Paleček] [PATCH][C++] Fix constant reference in a lambda (PR c++/53488)

2012-08-31 Thread Jason Merrill
Thanks for the patch! The idea of the fix is to postpone the decision whether or not to capture later to the template instantiation. That makes sense. We might as well postpone all default captures to instantiation time, since we need to postpone some of them. +/* This is a hack

Re: [Jiří Paleček] [PATCH][C++] Fix constant reference in a lambda (PR c++/53488)

2012-08-31 Thread Gabriel Dos Reis
On Fri, Aug 31, 2012 at 6:00 PM, Jason Merrill wrote: > Thanks for the patch! > >> The idea of the fix is to postpone the decision whether or not to capture >> later to the template instantiation. > > > That makes sense. We might as well postpone all default captures to > instantiation time, sinc

Re: [Jiří Paleček] [PATCH][C++] Fix constant reference in a lambda (PR c++/53488)

2012-09-01 Thread Jason Merrill
On 08/31/2012 09:17 PM, Gabriel Dos Reis wrote: Hmm, would we not run the risk of doing the "wrong" capture if everything is postponed? We wouldn't postpone name lookup, just the capture transformation. The long-term solution is to implement the rules properly, which depend on how a variable

Re: [Jiří Paleček] [PATCH][C++] Fix constant reference in a lambda (PR c++/53488)

2012-09-01 Thread Gabriel Dos Reis
On Sat, Sep 1, 2012 at 10:50 AM, Jason Merrill wrote: > On 08/31/2012 09:17 PM, Gabriel Dos Reis wrote: >> >> Hmm, would we not run the risk of doing the "wrong" capture if everything >> is postponed? > > > We wouldn't postpone name lookup, just the capture transformation. > > The long-term soluti