[Issue 17331] appender can't be used for initialization twice

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 20 17:15:56 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=17331

Tomáš Chaloupka <chalucha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chalucha at gmail.com

--- Comment #1 from Tomáš Chaloupka <chalucha at gmail.com> ---
Here is another one:

import std.stdio;
import std.array;

class Foo
{
        auto bar = appender!(int[])();
        //auto bar = Appender!(int[])(); // Works ok
}

void main()
{
        auto f1 = new Foo();
        auto f2 = new Foo();
        f1.bar ~= 1;
        f2.bar ~= 2;

        writeln(f1.bar.data);
        writeln(f2.bar.data);
}

With appender output is:
[1, 2]
[1, 2]

With Appender:
[1]
[2]

Tested on v2.078.3 and v2.079.0

--


More information about the Digitalmars-d-bugs mailing list