[Issue 8563] Exception segfault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 18 11:03:59 PST 2013


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



--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-02-18 11:03:57 PST ---
Further reduced:

struct Foo
{
    int[100] i;
}

struct DirIterator
{
    Foo* _store ;

    ~this()
    {
        if (_store)
        {
            _store.i = 0; // to segfault for sure
            _store = null;
        }
    }
    this(string pathname)
    {
        throw new Exception("");
    }
    void popFront() { }
    bool empty()  { return true; }
    Foo front() { return *_store; }
}

auto dirEntries()
{
    return DirIterator("path");
}

void main() {
    foreach(s; dirEntries()) {} 
}

This looks like issue 9438 (struct with pointer field and dtor) but now
temporaries from function return values are involved.

-- 
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