Thread overview
[Issue 3958] New: mixin(non-static method) crashes compiler
Mar 13, 2010
Vladimir
Mar 13, 2010
nfxjfg@gmail.com
Mar 15, 2010
Don
Mar 28, 2010
Walter Bright
Apr 09, 2010
Don
March 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3958

           Summary: mixin(non-static method) crashes compiler
           Product: D
           Version: 1.057
          Platform: All
               URL: http://thecybershadow.net/
        OS/Version: All
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir <thecybershadow@gmail.com> 2010-03-13 14:53:46 PST ---
struct S
{
    string g() { return ""; }
    void f() { mixin(g()); }
}


Making g() static stops DMD from crashing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3958


nfxjfg@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nfxjfg@gmail.com


--- Comment #1 from nfxjfg@gmail.com 2010-03-13 14:58:02 PST ---
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.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3958


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-03-15 12:21:05 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3958


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2010-03-28 12:40:14 PDT ---
changeset 424

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3958


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2010-04-09 13:38:29 PDT ---
Fixed DMD1.048 and 2.043.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------