Bug 3305 – Segfault(expression.c) with recursive struct template alias expressions
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-09-07T08:26:00Z
Last change time
2015-06-09T01:20:50Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2009-09-07T08:26:42Z
This is the third bug in bug 3293. Hard to explain, but here is the test case:
----
struct bug3305(alias X = 0) {
auto guard = bug3305b!(0).guard;
}
struct bug3305b(alias X = 0){
bug3305!(X) goo;
auto guard = 0;
}
void test(){
bug3305!(0) a;
}
---
Segfaulting in expression.c, Expression::deref(), with a NULL type.
Comment #1 by clugdbug — 2009-09-25T06:52:20Z
This is trivial. expression.c, line 1246. It's already an error, we just need to prevent it from crashing.
Expression *Expression::deref()
{
//printf("Expression::deref()\n");
- if (type->ty == Treference)
+ if (type && type->ty == Treference)
{ Expression *e;