Consider the following struct which attempts to legally cast away const: struct A { int[] a; A foo() const { return A.init; } alias foo this; } The compiler segfaults, all the way back to 2.064. This is the minimum I could do to make it happen. If you change anything, it seems to start compiling. In LDC, it says "illegal instruction: 4" If you use -v, I get this output: predefs DigitalMars Posix OSX darwin LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert D_HardFloat binary dmd version v2.075.1 config /Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/dmd.conf parse testimplicitmutable importall testimplicitmutable import object (/Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/../../src/druntime/import/object.d) import core.attribute (/Users/steves/.dvm/compilers/dmd-2.075.1/osx/bin/../../src/druntime/import/core/attribute.d) semantic testimplicitmutable semantic2 testimplicitmutable semantic3 testimplicitmutable Segmentation fault: 11
should say, attempts to legally *implicitly* cast away const.
This happens because the built-in `opEquals' that's synthesized by the compiler contains a condition such as `(p == q)` that's recursively expanded into `(p.foo == q) and `(p.foo.foo == q)`. The problem lies in `resolvePropertiesX' that keeps assembling this crazy chain where the `p' is substituted every step.
Hm... so alias this resolution needs some kind of memoization to prevent infinite expansion. Interesting.
fixed since 2.086