[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 RazvanN changed: What|Removed |Added Component|dmd |phobos --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #9 from RazvanN --- I'm not sure this is a dmd issue. For example, this compiles just fine: void main(){ import std.algorithm; //import std.stdio; void delegate(void*) dg; void delegate(void*)[] dgs = [dg, dg, dg]; //dgs.writeln; dgs.remove(1); } However uncommenting the commented lines issues the error. I suspect something was broken in the innards of writeln. --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #8 from ArturG --- (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; } --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #7 from ArturG --- (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; } --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #6 from ArturG --- (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; --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #5 from ArturG --- (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; } --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #4 from ArturG --- std.container and std.variant are also affected by this, none of them workd with a void delegate(void*). --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #3 from ArturG --- (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); --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #2 from ArturG --- 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); --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #1 from Steven Schveighoffer --- 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. --
[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails
https://issues.dlang.org/show_bug.cgi?id=18451 Steven Schveighoffer 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 --