On 2011-12-15 08:43, Jonathan M Davis wrote:
On Thursday, December 15, 2011 08:19:39 Jacob Carlborg wrote:
On 2011-12-14 18:00, Jonathan M Davis wrote:
On Wednesday, December 14, 2011 12:11:03 Jacob Carlborg wrote:
On 2011-12-14 11:10, Walter Bright wrote:
On 12/14/2011 1:59 AM, Jacob Carlborg wrote:
What happened to arrays in this release:

void foo (Object[] a) {}
class Foo {}

void main ()
{
Foo[] b;
foo(b);
}

The above code fails with the following message:

main.d(54): Error: function main.foo (Object[] a) is not callable
using argument
types (Foo[])
main.d(54): Error: cannot implicitly convert expression (b) of
type
Foo[] to
Object[]

Have I missed something, I can't find this in the changelog?

I don't remember if there was a bugzilla entry for it, but it's the
object slicing problem. The thing is, main() expects b to be an
array of Foo's. If foo() replaces one of the array elements with an
Object, then b is no longer an array of Foo's, and can crash.

I think it would be good if it's in the changelog, even if there is no
bugzilla entry for it.

It's the first dmd bug on the list:
http://d.puremagic.com/issues/show_bug.cgi?id=2095

- Jonathan M Davis

I see, thanks. I was search for "array" on the changelog page.

The names of bug reports are frequently not particularly informative, and even
if they are, they frequently don't contain the necessary information to
understand the effects of fixing the bug. If you want to actually know what's
really being fixed, you frequently have to actually read all of the bug reports
rather than looking at their titles.

- Jonathan M Davis

Yeah, I guess.

--
/Jacob Carlborg

Reply via email to