www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Possible bug with ? : and const

reply zildjohn01 <how are.you> writes:
I've boiled it down to this:

bool flag() {
	bool left, right;
	return true ? cast(const bool)left : cast(bool)right;
}

Error: cannot implicitly convert expression (cast(int)left) of type int to bool

It seems like whenever the left and right sides differ in const-ness or
invariant-ness, dmd tries to convert the left side to an int. Can anyone
confirm or explain?
Mar 05 2009
parent reply Someone Else <or possibly.not> writes:
zildjohn01 Wrote:

 some code
Please don't be so quick to shove me off the first page. At least drop it in dmd real quick and confirm this. Or tell me i'm dead wrong, that'd be cool too. Should I skip the forums and file the bug?
Mar 06 2009
parent "Denis Koroskin" <2korden gmail.com> writes:
On Fri, 06 Mar 2009 20:14:34 +0300, Someone Else <or possibly.not> wrote:

 zildjohn01 Wrote:

 some code
Please don't be so quick to shove me off the first page. At least drop it in dmd real quick and confirm this. Or tell me i'm dead wrong, that'd be cool too. Should I skip the forums and file the bug?
Yes, I believe it is a bug and needs to be reported via bugzilla: http://d.puremagic.com/issues/
Mar 06 2009