Skip to content

Are capturing lambdas supported? #3

@SelfishOlex

Description

@SelfishOlex

With the default configuration the following code segfaults:

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

    test();

    REQUIRE(a == 1);
}

Until I increase DELEGATE_ARGS_SIZE.

#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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions