Thread overview
[Issue 17246] [REG2.053] Extra destructor call.
[Issue 17246] Extra destructor call.
Mar 08, 2017
Ketmar Dark
Jul 02, 2017
Vladimir Panteleev
Oct 24, 2017
Walter Bright
Dec 09, 2017
Mike Franklin
March 08, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

Ketmar Dark <ketmar@ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar@ketmar.no-ip.org

--
July 02, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net
            Summary|Extra destructor call.      |[REG2.053] Extra destructor
                   |                            |call.
           Severity|critical                    |regression

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Same example with asserts replacing writelns, and checks based on simple reference counting:

struct Foo
{
    int* rc;
    this(int val)
    {
        rc = new int;
        (*rc) = 1;
    }
    this(this)
    {
        (*rc)++;
    }
    ~this()
    {
        if (rc)
        {
            assert(*rc > 0);
            (*rc)--;
        }
    }
}

struct Bar
{
    Foo foo;
    this(Foo foo, bool)
    {
        this.foo = foo;
    }
}

bool fun(bool val) { return !val; }

auto genBar(bool flag)
{
    return flag ? Bar() : Bar(Foo(10), fun(!flag));
}

void main(string[] args)
{
    auto bar = genBar(args.length == 0);
}

This appears to be a regression, as it worked before 2.052.

Introduced in https://github.com/dlang/dmd/commit/e764b3949ae0f95f8fc4d7d2e9114e29fee12493

--
October 24, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/dlang/dmd/pull/7238

--
October 26, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/6eccdeee1d4c41abb0a6e8733e13a85b63765266 fix Issue 17246 - [REG2.053] Extra destructor call.

https://github.com/dlang/dmd/commit/614da7260f173ae5dc0ec87e8fa85d3edfb031ce Merge pull request #7238 from WalterBright/fix17246

fix Issue 17246 - [REG2.053] Extra destructor call.

--
December 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

Mike Franklin <slavo5150@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slavo5150@yahoo.com

--- Comment #4 from Mike Franklin <slavo5150@yahoo.com> ---
*** Issue 18050 has been marked as a duplicate of this issue. ***

--
December 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

--- Comment #5 from Steven Schveighoffer <schveiguy@yahoo.com> ---
*** Issue 17897 has been marked as a duplicate of this issue. ***

--
December 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17246

--- Comment #6 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/6eccdeee1d4c41abb0a6e8733e13a85b63765266 fix Issue 17246 - [REG2.053] Extra destructor call.

https://github.com/dlang/dmd/commit/614da7260f173ae5dc0ec87e8fa85d3edfb031ce Merge pull request #7238 from WalterBright/fix17246

--