www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3423] New: The Bartosz Blocker

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



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: -------
Oct 20 2009
next sibling parent reply d-bugmail puremagic.com writes:
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



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: -------
Oct 20 2009
parent Don <nospam nospam.com> writes:
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
 
 

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 :)
 
Oct 20 2009
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 06 2009