[Issue 2084] New: operator ?: does not compute the tightest type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 8 23:15:56 PDT 2008


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

           Summary: operator ?: does not compute the tightest type
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


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.


-- 



More information about the Digitalmars-d-bugs mailing list