Skip to content
This repository was archived by the owner on Sep 9, 2019. It is now read-only.

Conversation

@thekid
Copy link
Contributor

@thekid thekid commented Sep 19, 2015

The lambda was also capturing variables declared only locally inside the lambda itself, which lead to an "undefined variable" warning.

Example:

void scope() {
  $factor= 3;
  return $a -> {
    $base= 100;
    return $base + $factor * 3;
  };
}

Above, factor needs to be captured, while base should not be

The lambda was also capturing variables declared only locally inside
the lambda itself, which lead to an "undefined variable" warning.

Example:

void scope() {
  $factor= 3;
  return $a -> {
    $base= 100;
    return $base + $factor * 3;
  };
}

Above, factor needs to be captured, while base should not be
@thekid thekid added the bug label Sep 19, 2015
thekid added a commit that referenced this pull request Sep 20, 2015
Fix capturing of local variables in lambdas
@thekid thekid merged commit 0fb0f23 into master Sep 20, 2015
@thekid thekid deleted the fix/lambdas-capturing branch September 20, 2015 10:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants