[Issue 3423] New: The Bartosz Blocker
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Oct 20 06:50:47 PDT 2009
    
    
  
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: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list