Bug 6029 – Regression(2.053): DMD stack overflow with invalid alias this
Status
RESOLVED
Resolution
WORKSFORME
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-18T11:15:00Z
Last change time
2012-02-05T00:02:37Z
Keywords
ice
Assigned to
nobody
Creator
robert
Comments
Comment #0 by robert — 2011-05-18T11:15:08Z
struct A
{
static A a;
alias a this;
}
void foo(A a)
{
}
void main()
{
foo(A);
}
Results in a stack overflow using latest git. No overflow with 2.052.
Comment #1 by yebblies — 2011-07-03T09:28:16Z
For me this prints:
TypeExp::toElem()
testx.d(13): Error: type A is not an expression
on win32.
So it seems to be fixed, unless it is platform specific. Please reopen if so.
dmd 2.054
Comment #2 by robert — 2011-07-10T04:44:57Z
Works for me now.
Comment #3 by hoganmeier — 2011-11-03T08:34:59Z
It isn't fixed.
struct A
{
static A a;
alias a this;
}
void foo(A a)
{
}
void main()
{
// foo(A); // Error: type A is not an expression
int s = A; // Error: type A has no value + stack overflow
}
Comment #4 by hoganmeier — 2011-11-03T08:36:39Z
*** Issue 6030 has been marked as a duplicate of this issue. ***
Comment #5 by hoganmeier — 2011-11-03T08:43:09Z
caused by mtype.c:
// 'from' is A and 'to' is int
static MATCH aliasthisConvTo(AggregateDeclaration *ad, Type *from, Type *to)
{
assert(ad->aliasthis);
Declaration *d = ad->aliasthis->isDeclaration();
if (d)
{ assert(d->type);
Type *t = d->type; // <-- gets struct type A again
if (d->isVarDeclaration() && d->needThis())
{
t = t->addMod(from->mod);
}
...
MATCH m = t->implicitConvTo(to);
Guess it should be caught earlier though.
Comment #6 by yebblies — 2012-02-01T03:41:31Z
> int s = A; // Error: type A has no value + stack overflow
I still can't reproduce this. What version/os?
Comment #7 by github-bugzilla — 2012-02-05T00:02:00Z