Thread overview
[Issue 3423] New: The Bartosz Blocker
Oct 20, 2009
Don
[Issue 3423] Destructor and postblit don't get copied to the header file when using -H
Oct 20, 2009
Leandro Lucarella
Oct 20, 2009
Don
Nov 06, 2009
Walter Bright
October 20, 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@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@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: -------
October 20, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3423


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax@gmail.com
            Summary|The Bartosz Blocker         |Destructor and postblit
                   |                            |don't get copied to the
                   |                            |header file when using -H


--- Comment #1 from Leandro Lucarella <llucax@gmail.com> 2009-10-20 08:45:57 PDT ---
I've taken the freedom to change the title because it was very informative really. I hope you don't mind, but using a good title for the bug report help people to find the correct bug and avoids duplicates and bug maintenance overhead.

Thanks for the patch BTW :)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 20, 2009
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=3423
> 
> 
> Leandro Lucarella <llucax@gmail.com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |llucax@gmail.com
>             Summary|The Bartosz Blocker         |Destructor and postblit
>                    |                            |don't get copied to the
>                    |                            |header file when using -H
> 
> 
> --- Comment #1 from Leandro Lucarella <llucax@gmail.com> 2009-10-20 08:45:57 PDT ---
> I've taken the freedom to change the title because it was very informative
> really. I hope you don't mind, but using a good title for the bug report help
> people to find the correct bug and avoids duplicates and bug maintenance
> overhead.

Actually, the new title is NOT more informative. Your title makes it sounds like this is innocuous. If I'd used your title, you probably wouldn't have noticed it... I'm worried it'll get lost now.

> 
> Thanks for the patch BTW :)
> 
November 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3423


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2009-11-06 11:34:44 PST ---
Fixed dmd 2.036

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