bitwizeshift / bitwizeshift/Delegate

Are capturing lambdas supported?

Open
#3 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
26
Forks
1
PR merge metrics
No merged PRs in 30d

Description

With the default configuration the following code segfaults:

```cpp
TEST_CASE("Delegate test with large capture")
{
int a = 0, b, c, d;
delegate::Delegate test([&a, &b, &c]()
{
a = 1;
});

test();

REQUIRE(a == 1);
}
```

Until I increase DELEGATE_ARGS_SIZE.
```cpp
#define DELEGATE_ARGS_SIZE sizeof(int) + sizeof(int *) /* + N */
```

So it seems to work when the capturing lambda only captures 2 words worth of memory. Is this working as intended?
Or should I expect lambdas of any size to fail at some point in the future for me?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.