[Issue 5723] array of base class cannot be initialized with derived types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 9 05:44:07 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5723


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy at yahoo.com
         Resolution|                            |DUPLICATE


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-03-09 05:41:07 PST ---
(In reply to comment #0)
> As a workaround, I found :
> A[] ar = [b, cast(A)c];
> 
> In fact, all items except the first one have to be casted. 

No, this is not the case.  You can cast the whole array literal, or you can
cast one element to A (any element will do).

Marking as duplicate.

*** This issue has been marked as a duplicate of issue 5498 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list