[Issue 3543] [tdpl] ternary operator can't find common type for classes/interfaces

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 17 10:15:22 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=3543

--- Comment #15 from bearophile_hugs at eml.cc ---
The same problem found by "Uranuz":
http://forum.dlang.org/thread/xgxgfwltboextlmfjhgj@forum.dlang.org


interface IBase {}
class Impl(T): IBase {
    T value;
}
void main() {
    IBase a = true ? (new Impl!uint) : (new Impl!string);
}



test.d(6,23): Error: cannot implicitly convert expression (new 
Impl!uint) of type object.Object to test.IBase

--


More information about the Digitalmars-d-bugs mailing list