www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3958] New: mixin(non-static method) crashes compiler

reply d-bugmail puremagic.com writes:
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



---
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: -------
Mar 13 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3958


nfxjfg gmail.com changed:

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



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: -------
Mar 13 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Mar 15 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3958


Walter Bright <bugzilla digitalmars.com> changed:

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



12:40:14 PDT ---
changeset 424

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 28 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3958


Don <clugdbug yahoo.com.au> changed:

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



Fixed DMD1.048 and 2.043.

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