dmd/compiler/test/compilable/issue24174.d
Mai-Lapyst d06917a832
Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a infinite loop (#15651)
* Fix issue 24174 - [CTFE] goto within with statements & catch blocks cause a infinite loop

* Remove main from test compileable/issue24174.d
2023-10-05 10:28:49 +03:00

36 lines
525 B
D

/* TEST_OUTPUT:
---
true
false
---
*/
bool func1() {
struct BtMatcher {
uint pc = 0;
}
BtMatcher matcher;
with (matcher) {
goto StartLoop;
StartLoop:
goto SecondLabel;
SecondLabel:
return true;
}
}
bool func2() {
try {
throw new Exception("a");
return true;
} catch (Exception e) {
goto StartA;
StartA:
goto StartB;
StartB:
return false;
}
}
pragma(msg, func1());
pragma(msg, func2());