The following code fails to compile: ``` alias scope void delegate() AltDg; void foo (AltDg dg) @nogc {} void main () @nogc { uint i; foo(() { i = 1; }); } ``` Error message: `foo.d(4): Error: function D main @nogc function allocates a closure with the GC` Using `void foo (scope AltDg dg) @nogc {}` works fine.
As scope is a storage class, it cannot be part of a type or alias declaration, i.e. just like ref you can add it for parameters and unlike ref, scope can be used on variable declarations.
It should possibly be made an error to declare such aliases.
https://github.com/dlang/dmd/pull/10018 deprecated this.