Summary: Yet another dtor/postblit problem?
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD

--- Comment #0 from Dmitry Olshansky <> 2011-08-30 
14:12:40 PDT ---
Test case creates a instance of nested struct, and prints ctor/postblit/dtor
activity + address of this. Reduced from upcoming regex module, where it's
causing segfaults but only with -inline (dumb luck?).

import std.stdio;
struct R
    this(int k)
        writefln("R created %x", &this);
    this(this){ writefln("R postblit %x", &this); }

    ~this(){  writefln("R destroyed %x", &this); }

struct S
    R _match;

    this( int separator)
      _match = R(separator);
      writefln("S created %x", cast(void*)&this);
      writefln("S postblit %x", cast(void*)&this);
      writefln("S destroyed %x", cast(void*)&this);

void split(int rx)
    auto spl = S(rx);
    writefln("**** Spl is at address %x", cast(void*)&spl);

void main(string[] argv)

The end result for me looks like this:

R created 18fdc0
R destroyed 18fdc4  // killed wrong guy or missing a postblit at 18fe08?
S created 18fe08
**** Spl is at address 18fe08
S destroyed 18fe08
R destroyed 18fe08 

Bottom line: dtor called twice, ctor called once and not a single postblit. 
Saldo is negative ...

That's on almost latest DMD (commit c5c8500a13f222935f00145c16dfbc2d32351b0f)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to