Tested with DMD 2.081.2. This bug does not seem to occur on DMD 2.073. The following example causes DMD to ICE with a segfault: $ cat example.d class Foo { shared this() { } } void main() { scope foo = new shared Foo(); } $ dmd example.d Segmentation fault If you replace scope by auto then it will compile just fine.
This looks like a backend bug.
https://github.com/dlang/dmd/pull/9109
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/2d658b7ed076ba789e67907ec37be2ff0671fd1f fix Issue 19491 - ICE (segfault) when initializing scope variable with shared type https://github.com/dlang/dmd/commit/57c8a5e4a70144846359051d7c9c1ff4612cbd57 Merge pull request #9109 from WalterBright/fix19491 fix Issue 19491 - ICE (segfault) when initializing scope variable wit… merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>