D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5156 - Wrong type inference for array literals containing classes
Summary: Wrong type inference for array literals containing classes
Status: RESOLVED DUPLICATE of issue 3543
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2010-11-02 11:13 UTC by Simen Kjaeraas
Modified: 2015-06-09 05:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Simen Kjaeraas 2010-11-02 11:13:20 UTC
class A{}
class B:A{}
class C:A{}

auto a = [new B, new C]; // Fails

a clearly should be of type A[], but such is not the case.
Comment 1 bearophile_hugs 2010-11-02 11:25:50 UTC
I think this is a dupe, see bug 4030  and bug 3543
Comment 2 Simen Kjaeraas 2010-11-02 11:30:21 UTC
You're right. 3543 shows another problem too, and I focused mostly on that (the ?: example).

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