On 11/12/2025 4:54 AM, Basile B. wrote:
On Wednesday, 10 December 2025 at 15:32:39 UTC, Richard (Rikki) Andrew
Cattermole wrote:
It was removed.
Its dead code, not hurting anyone, and just being plain annoying with
templates.
at least `main()` is a problem. Obviously the examples are catchy on
purpose. Prepare a console and killall.
Seriously I don't get your argument.
If that is instantiated with an int for the type, it errored.
This happened enough that it was on peoples hit list as a false positive
nearing 100% of the time they got it.
```d
void func(T)() {
static if (is(T = int)) {
assert(0);
}
writeln("hello");
}
```
-----------------------------
In your example, infinite loops can be valid and desirable things.
If you want to catch that it should be done with a static analyzer, not
as part of the compiler.
It will get optimized to:
```
_Dmain:
.Lfunc_begin0:
.cfi_startproc
.p2align 4, 0x90
.LBB0_1:
jmp .LBB0_1
.Lfunc_end0:
.size _Dmain, .Lfunc_end0-_Dmain
.cfi_endproc
```
Compilers keep these loops for a reason.