Re: Using Lambda with variables in deriving class: Regression or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17 February 2012 10:30, Deniz Sarikaya wrote:
>
> As a workaround I turned
>
> [&variable]() -> void
> {
>     variable->memfunc();
> }
>
> to
>
> [&]() -> void
> {
>     variable->memfunc();
> }
>
>
> Did I do something wrong or why is this not working anymore?

I'm guessing the problem has nothing to do with derived classes, it's
that identifiers in the capture-list must be local variables or 'this'
so to capture a member you must capture 'this'

So you probably want:

[this]() -> void
{
    variable->memfunc();
}

GCC 4.6 accepted incalid captures but that was probably changed by the
fix for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50736



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux