Bug 3293 – ICE(expression.c) recursive alias template parameters
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-09-03T13:23:00Z
Last change time
2015-06-09T01:28:07Z
Keywords
ice-on-invalid-code
Assigned to
nobody
Creator
2korden
Comments
Comment #0 by 2korden — 2009-09-03T13:23:55Z
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)()[];
}
}
Comment #1 by clugdbug — 2009-09-07T03:18:35Z
(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.
Comment #2 by clugdbug — 2009-09-07T08:29:30Z
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.
Comment #3 by clugdbug — 2009-09-08T08:51:49Z
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;
Comment #4 by clugdbug — 2009-09-08T13:30:18Z
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.