digitalmars.D - Array type inference
- "James Miller" <james aatch.net> May 03 2012
- Jonathan M Davis <jmdavisProg gmx.com> May 03 2012
I am using an array of objects, all of which have a common type (They are all sub classes of Field). If I declare an array of these objects, D seems to try to cast them all to the last type in the array, rather than picking a common supertype. This happens even if I specify a type for the array, D still doesn't cast the types properly. In the error message it also seems that it casts _some_ types properly, but others not, resulting in some very strange error messages. I can work around this by casting all of the elements to the common supertype, but this is not ideal. Is this a known bug, expected functionality, or should I file a bug request? -- James Miller
May 03 2012
On Friday, May 04, 2012 08:33:32 James Miller wrote:I am using an array of objects, all of which have a common type (They are all sub classes of Field). If I declare an array of these objects, D seems to try to cast them all to the last type in the array, rather than picking a common supertype. This happens even if I specify a type for the array, D still doesn't cast the types properly. In the error message it also seems that it casts _some_ types properly, but others not, resulting in some very strange error messages. I can work around this by casting all of the elements to the common supertype, but this is not ideal. Is this a known bug, expected functionality, or should I file a bug request?
http://d.puremagic.com/issues/show_bug.cgi?id=5498 - Jonathan M Davis
May 03 2012








Jonathan M Davis <jmdavisProg gmx.com>