Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
January 09, 2020 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 Ketmar Dark <ketmar@ketmar.no-ip.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ketmar@ketmar.no-ip.org -- |
January 13, 2020 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |moonlightsentinel@disroot.o | |rg --- Comment #1 from moonlightsentinel@disroot.org --- Test case without phobos: --------------------------- interface IFoo { size_t foo(size_t i); } class Bar : IFoo { size_t foo(size_t i) { return 2 * i; } } void main() { IFoo[] f; Bar[] b = [ new Bar() ]; // this works well and as expected f ~= b[0]; assert(f[0].foo(0) == 0); // this append the array with invalid values f ~= b; assert(f[0].foo(5) == 10); assert(f[1].foo(11) == 22); } --------------------------- The last assert fails with 13 != 22 and never worked before. -- |
January 13, 2020 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86_64 |All --- Comment #2 from moonlightsentinel@disroot.org --- Windows -m64: 14 != 22 Windows -m32: Access Violation -- |
January 13, 2020 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 Nate <ng069976@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ng069976@gmail.com --- Comment #3 from Nate <ng069976@gmail.com> --- Attempt 1 this should work, but it doesn't: Foo[] x= new Foo[0]; Bar[] y= [ new Bar() ]; x ~= y; x ~= [y[0]]; // This should also work. Attempt 3 this shouldn't work, but some how it does: Foo[] x= new Foo[0]; Bar[] y= [ new Bar() ]; x ~= y[0]; -- |
January 13, 2020 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 Rainer Schuetze <r.sagitario@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |r.sagitario@gmx.de --- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> --- I think this is an "accepts-invalid" issue: class Bar and interface IFoo are not the same pointer, an implicit conversion adds an offset. But appending arrays with implicitly conversion is not supported, just like you cannot append an array of floats to an array of ints or vice versa. -- |
December 17, 2022 [Issue 20494] Appending derived class array to an interface array. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20494 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation