Infinite loop with nested sections and globals
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
Using Catch 1.2.1, I've found an issue which causes infinite loops. I've whittled down my code to a minimum reproducible test case:
``` c++
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
int a = 0;
TEST_CASE("") {
SECTION("") {
SECTION("") {
REQUIRE(a==0);
SECTION("") {
a=1;
SECTION("") {
}
SECTION("") {
}
}
}
}
}
```
I compiled this with `gcc version 4.9.3 (Debian 4.9.3-3)`
This loops forever with output like this:
```
a.out is a Catch v1.2.1 host application.
Run with -? for options
-------------------------------------------------------------------------------
Anonymous test case 1
-------------------------------------------------------------------------------
test_case.cpp:6
...............................................................................
test_case.cpp:9: FAILED:
REQUIRE( a==0 )
with expansion:
1 == 0
-------------------------------------------------------------------------------
Anonymous test case 1
-------------------------------------------------------------------------------
test_case.cpp:6
...............................................................................
test_case.cpp:9: FAILED:
REQUIRE( a==0 )
with expansion:
1 == 0
```
Contributor guide
Assessment
This issue has not been assessed yet.