D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3305 - Segfault(expression.c) with recursive struct template alias expressions
Summary: Segfault(expression.c) with recursive struct template alias expressions
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
 
Reported: 2009-09-07 08:26 UTC by Don
Modified: 2015-06-09 01:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2009-09-07 08:26:42 UTC
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 Don 2009-09-25 06:52:20 UTC
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;
Comment 2 Walter Bright 2009-10-06 02:18:14 UTC
Fixed dmd 1.048 and 2.033