Skip to content

Cannot use automatic variables in CESTER_BEFORE_ALL #50

@MarcelInTO

Description

@MarcelInTO

I used something like this:

CESTER_BEFORE_ALL(inst,  
    std::vector setup;
    inst->arg = & setup;
)

This did not work because the destructor for 'setup' was called before any of the tests were actually called.

This should be a big Warning in the documentation for CESTER_BEFORE_ALL. I know the example uses dynamic allocation which gets around the problem, but it does not explain why. I think it needs a clear statement that you must use data that is not automatically deallocated.

In hindsight I understand why this is, but it took me a while to figure out why I was crashing and I think others will make the same mistake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions