Bug 5156 – Wrong type inference for array literals containing classes

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-11-02T11:13:00Z
Last change time
2015-06-09T05:12:00Z
Keywords
rejects-valid
Assigned to
nobody
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2010-11-02T11:13:20Z
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 by bearophile_hugs — 2010-11-02T11:25:50Z
I think this is a dupe, see bug 4030 and bug 3543
Comment #2 by simen.kjaras — 2010-11-02T11:30:21Z
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 ***