Bug 3958 – mixin(non-static method) crashes compiler

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2010-03-13T14:53:00Z
Last change time
2014-02-15T02:18:58Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2010-03-13T14:53:46Z
struct S { string g() { return ""; } void f() { mixin(g()); } } Making g() static stops DMD from crashing.
Comment #1 by nfxjfg — 2010-03-13T14:58:02Z
There's another problem. This fails to compile: struct S { static string g() { return null; } void f() { mixin(g()); } //line 4 } z.d(4): Error: argument to mixin must be a string, not (null) (Tested with dmd v2.041.)
Comment #2 by clugdbug — 2010-03-15T12:21:05Z
PATCH(against 2.042): This is trivial. // interpret.c line 2569: if (pthis && fd) { // Member function call if (pthis->op == TOKthis) - pthis = istate->localThis; + pthis = istate ? istate->localThis : NULL; else if (pthis->op == TOKcomma) pthis = pthis->interpret(istate); The second issue is that mixin(null); is never allowed. It's completely unrelated to this bug. Create a new bug for it if you think it matters.
Comment #3 by bugzilla — 2010-03-28T12:40:14Z
changeset 424
Comment #4 by clugdbug — 2010-04-09T13:38:29Z
Fixed DMD1.048 and 2.043.