Skip to content

When the same SECTION is encountered multiple times in one cycle, catch crashes on assert #2802

@mjerabek

Description

@mjerabek

Describe the bug

Suppose we have nested SECTIONs in a helper function and call that function from one TEST_CASE, from the same section. Then the same sections are entered multiple times (because they have the same name and location). The same could be achieved by a loop.

In that scenario, Catch asserts/segfaults (see the attached compiler explorer link).

Expected behavior

Either it should work "as expected", or it should error out with a reasonable error message. Also, the documentation of SECTION should include clear warning that this is not supported (also a link to DYNAMIC_SECTION would be handy).

Reproduction steps

https://godbolt.org/z/rMP8vf6xe

Platform information:

  • Catch version: devel

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions