http://d.puremagic.com/issues/show_bug.cgi?id=3423

           Summary: The Bartosz Blocker
           Product: D
           Version: 2.035
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch, wrong-code
          Severity: blocker
          Priority: P1
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2009-10-20 06:50:46 PDT ---
This landmine nearly cost us one of our top developers. Hours and hours to
track down, less than a minute to patch.

Reduced test case: compile with -H. The destructor and postblit don't get
copied to the header file. 
This doesn't generate any compile-time errors, but causes really weird
behaviour, including run-time crashes: the functions are present when compiled
into a library, but are missing when the library is used.

struct Foo
{
   int k;
   ~this() { k = 1; }
   this(this) { k = 2; }
}

PATCH: func.c line 2892 and 2800

void DtorDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
-   if (hgs->hdrgen)
-    return;
    buf->writestring("~this()");
    bodyToCBuffer(buf, hgs);
}

void PostBlitDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
{
-    if (hgs->hdrgen)
-    return;
-    buf->writestring("=this()");
+    buf->writestring("this(this)");
    bodyToCBuffer(buf, hgs);
}

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

Reply via email to