Jump to page: 1 2
Thread overview
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
[Issue 18451] rejects-valid since 2.076.1
Feb 17, 2018
ArturG
Feb 17, 2018
ArturG
Feb 20, 2018
ArturG
Feb 20, 2018
ArturG
Feb 20, 2018
ArturG
Feb 21, 2018
ArturG
Feb 21, 2018
ArturG
Dec 18, 2018
RazvanN
Feb 23
RazvanN
February 16, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |schveiguy@yahoo.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--
February 16, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|rejects-valid since 2.076.1 |[REG 2.076.1] In certain
                   |                            |circumstances, calling
                   |                            |remove on an array of
                   |                            |delegates fails

--
February 16, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> ---
A couple more notes:

Putting a pragma(msg, isInputRange!(typeof(dgs))) before the remove line seems
to make it succeed to compile.

Removing the writeln after the remove also makes it succeed.

--
February 17, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #2 from ArturG <var.spool.mail700@gmail.com> ---
its actually not only remove this fail also:

    void delegate(void*) dg = delegate(void*){ writeln("test"); };
    void delegate(void*) dg2;
    void delegate(void*)[] dgs = [dg,dg,dg,dg];
    //pragma(msg, isInputRange!(typeof(dgs)));
    //assert(isInputRange!(typeof(dgs)));
    dgs.writeln;
    void delegate(void*)[] dgs2 = [null, null, null, null];
    //moveAll(dgs, dgs2);
    //move(dgs.front, dgs2.front);
    move(dg, dg2);
    dg2(null);

and this actually works:
    void delegate(void*) dg = delegate(void*){ writeln("test"); };
    void delegate(void*) dg2;
    void delegate(void*)[] dgs = [dg,dg,dg,dg];
    void delegate(void*)[] dgs2 = [null, null, null, null];
    dgs.writeln;
    moveAll(dgs, dgs2);
    move(dgs.front, dgs2.front);
    move(dg, dg2);
    dg2(null);

--
February 17, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #3 from ArturG <var.spool.mail700@gmail.com> ---
(In reply to ArturG from comment #2)
> its actually not only remove this fail also:
> 
>     void delegate(void*) dg = delegate(void*){ writeln("test"); };
>     void delegate(void*) dg2;
>     void delegate(void*)[] dgs = [dg,dg,dg,dg];
>     //pragma(msg, isInputRange!(typeof(dgs)));
>     //assert(isInputRange!(typeof(dgs)));
>     dgs.writeln;
>     void delegate(void*)[] dgs2 = [null, null, null, null];
>     //moveAll(dgs, dgs2);
>     //move(dgs.front, dgs2.front);
>     move(dg, dg2);
>     dg2(null);
> 
> and this actually works:
>     void delegate(void*) dg = delegate(void*){ writeln("test"); };
>     void delegate(void*) dg2;
>     void delegate(void*)[] dgs = [dg,dg,dg,dg];
>     void delegate(void*)[] dgs2 = [null, null, null, null];
>     dgs.writeln;
>     moveAll(dgs, dgs2);
>     move(dgs.front, dgs2.front);
>     move(dg, dg2);
>     dg2(null);

another example:

    void delegate(void*) dg = delegate(void*){ writeln("test"); };
    void delegate(void*) dg2;
    void delegate(void*)[] dgs = [dg,dg,dg,dg];

    //dgs.writeln; // fails
    auto s = "%(%s %)".format(dgs); // fails
    void delegate(void*)[] dgs2 = [null, null, null, null];
    //dgs.writeln; works
    //auto s = "%(%s %)".format(dgs); // works
    moveAll(dgs, dgs2);
    move(dgs.front, dgs2.front);
    move(dg, dg2);
    dg2(null);

--
February 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #4 from ArturG <var.spool.mail700@gmail.com> ---
std.container and std.variant are also affected by this, none of them workd with a void delegate(void*).

--
February 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #5 from ArturG <var.spool.mail700@gmail.com> ---
(In reply to ArturG from comment #4)
> std.container and std.variant are also affected by this, none of them workd with a void delegate(void*).

ok was able to find the code that broke std.container for me

template Temp(alias fun)
{
    enum foo1 = [__traits(getFunctionAttributes, fun)]; // fails
    //enum foo1 = __traits(getFunctionAttributes, fun); // works
}

void test(){}

void main(string[] args)
{
    import std.stdio, std.container;

    Temp!test.foo1.writeln;

    void delegate(void*) dg;
    SList!(void delegate(void*)) list;
    list.insert(dg);
    list[].writeln;
}

--
February 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #6 from ArturG <var.spool.mail700@gmail.com> ---
(In reply to ArturG from comment #5)
> (In reply to ArturG from comment #4)
> > std.container and std.variant are also affected by this, none of them workd with a void delegate(void*).
> 
> ok was able to find the code that broke std.container for me
> 
> template Temp(alias fun)
> {
>     enum foo1 = [__traits(getFunctionAttributes, fun)]; // fails
>     //enum foo1 = __traits(getFunctionAttributes, fun); // works
> }
> 
> void test(){}
> 
> void main(string[] args)
> {
>     import std.stdio, std.container;
> 
>     Temp!test.foo1.writeln;
> 
>     void delegate(void*) dg;
>     SList!(void delegate(void*)) list;
>     list.insert(dg);
>     list[].writeln;
> }

reduced it abit furter:

    import std.meta, std.conv;
    void delegate(void*) vdg;
    enum s = [Alias!("asd")].to!string;
    SList!(void delegate(void*)) list;
    list.insert(vdg);
    list.writeln;

--
February 21, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #7 from ArturG <var.spool.mail700@gmail.com> ---
(In reply to ArturG from comment #6)
> (In reply to ArturG from comment #5)
> > (In reply to ArturG from comment #4)
> > > std.container and std.variant are also affected by this, none of them workd with a void delegate(void*).
> > 
> > ok was able to find the code that broke std.container for me
> > 
> > template Temp(alias fun)
> > {
> >     enum foo1 = [__traits(getFunctionAttributes, fun)]; // fails
> >     //enum foo1 = __traits(getFunctionAttributes, fun); // works
> > }
> > 
> > void test(){}
> > 
> > void main(string[] args)
> > {
> >     import std.stdio, std.container;
> > 
> >     Temp!test.foo1.writeln;
> > 
> >     void delegate(void*) dg;
> >     SList!(void delegate(void*)) list;
> >     list.insert(dg);
> >     list[].writeln;
> > }
> 
> reduced it abit furter:
> 
>     import std.meta, std.conv;
>     void delegate(void*) vdg;
>     enum s = [Alias!("asd")].to!string;
>     SList!(void delegate(void*)) list;
>     list.insert(vdg);
>     list.writeln;

this fails since dmd 2.067.1

void main(string[] args) {
 import std.conv, std.container, std.stdio;
    void delegate(void*) vdg;
    auto s = [5f].to!(double[]);
    SList!(void delegate(void*)) list;
    list.insert(vdg);
    list.writeln;
}

--
February 21, 2018
https://issues.dlang.org/show_bug.cgi?id=18451

--- Comment #8 from ArturG <var.spool.mail700@gmail.com> ---
(In reply to ArturG from comment #7)
> (In reply to ArturG from comment #6)
> > (In reply to ArturG from comment #5)
> > > (In reply to ArturG from comment #4)
> > > > std.container and std.variant are also affected by this, none of them workd with a void delegate(void*).
> > > 
> > > ok was able to find the code that broke std.container for me
> > > 
> > > template Temp(alias fun)
> > > {
> > >     enum foo1 = [__traits(getFunctionAttributes, fun)]; // fails
> > >     //enum foo1 = __traits(getFunctionAttributes, fun); // works
> > > }
> > > 
> > > void test(){}
> > > 
> > > void main(string[] args)
> > > {
> > >     import std.stdio, std.container;
> > > 
> > >     Temp!test.foo1.writeln;
> > > 
> > >     void delegate(void*) dg;
> > >     SList!(void delegate(void*)) list;
> > >     list.insert(dg);
> > >     list[].writeln;
> > > }
> > 
> > reduced it abit furter:
> > 
> >     import std.meta, std.conv;
> >     void delegate(void*) vdg;
> >     enum s = [Alias!("asd")].to!string;
> >     SList!(void delegate(void*)) list;
> >     list.insert(vdg);
> >     list.writeln;
> 
> this fails since dmd 2.067.1
> 
> void main(string[] args) {
>  import std.conv, std.container, std.stdio;
>     void delegate(void*) vdg;
>     auto s = [5f].to!(double[]);
>     SList!(void delegate(void*)) list;
>     list.insert(vdg);
>     list.writeln;
> }

anything that somehow calls dup fails:

void main()
{
    import std.container, std.array;
    dup([4]);
    //Appender!(int[]) ap;
    SList!(void delegate(void*)) list;
}

--
« First   ‹ Prev
1 2