template ReferenceType(T) { alias T* ReferenceType; } struct SomeRange(T, alias Storage = 0) { bool foo() { return guard == guard; // bug 1: replace == with is and DMD crashes with no output } enum guard = cast(ReferenceType!(T))SomeContainer!(T, Storage).guard; } struct SomeContainer(T, alias Storage = 0) { auto opSlice() // bug 2: replace auto with SomeRange!(T, Storage) and get an ICE { return SomeRange!(T, Storage)(); } enum ReferenceType!(T) guard = cast(ReferenceType!(T))cast(void*)0xFEFEFEFE; // bug 3: remove guard type and DMD crashes with no output } class A { SomeRange!(int, 0) test() // bug 4: 0 is not omissible { return SomeContainer!(int)()[]; } }
(1) I can't see 'mixin' anywhere in any of these bugs! (2) Cannot reproduce bug 3. (3) Please don't report multiple bugs in a single bug report. There are definitely at least 3 different bugs in here. Bug 1 is Segfault(statement.c) bug 2 is ICE(expression.c) bug 4 is a rejects-valid. It's possible they all have the same root cause, but I doubt it.
Bug 1 is now its own issue, bug 3304. Bug 3 is now its own issue, bug 3305. They are completely unrelated to one another.
Here's a reduced test case for the second bug, which is ICE(expression.c). Something to do with recursive alias parameters causing data corruption. Only happens if there is an infinite template expansion, so I think this one is ice-on-invalid-code. Somehow defining the return type as 'auto' circumvents the infinite expansion -- but I'm not sure that it should. --- alias const(void*) VoidPtr; struct SomeRange(alias Storage){ const guard = cast(const void *)Bug3293!(Storage).guard; } struct Bug3293(alias Storage){ SomeRange!(Storage) foo; const VoidPtr guard = cast(void *)345; } SomeRange!(0) a = Bug3293!(0)().foo;
And the fourth bug has been moved to bug 3307. I'm therefore changing the title to reflect the remaining bug, as described in comment 3.
Thanks and sorry for confusion!
Fixed DMD2.047.