http://d.puremagic.com/issues/show_bug.cgi?id=2713
Summary: Error resolving types with ? : and const Product: D Version: 2.025 Platform: PC URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr oup=digitalmars.D&article_id=85423 OS/Version: All Status: NEW Keywords: rejects-valid Severity: minor Priority: P3 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: zildjoh...@gmail.com The following fails to compile: bool flag() { bool left, right; return true ? cast(const bool)left : cast(bool)right; } with the error "cannot implicitly convert expression (cast(int)left) of type int to bool". It seems to happen whenever the left and right sides differ in const-ness or invariant-ness. This becomes an issue when trying to write const-correct class functions which return bool, for example: class C { private int mask; private bool readyYet() const {return true;} public bool ExtractStateBit() const { return readyYet() ? (mask & 1) : false; } } --