Bug 2084 – operator ?: does not compute the tightest type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-05-09T01:15:00Z
Last change time
2015-06-09T05:15:08Z
Assigned to
bugzilla
Creator
andrei

Comments

Comment #0 by andrei — 2008-05-09T01:15:55Z
Consider: #!/home/andrei/bin/rdmd -w import std.stdio; class Base {} class D1 : Base {} class D2 : Base {} void main(string[] args) { auto b = args ? new D1 : new D2; } This program should compile and run, deducing Base as b's type. It fails to compile as written. Replacing "auto" with "Base" still doesn't help.
Comment #1 by bugzilla — 2008-05-22T05:05:44Z
Fixed dmd 1.030 and 2.014