if (int bar = .. bug or some thing

Joel joelcnz at gmail.com
Tue Oct 31 04:08:12 UTC 2017


The following code assert fails (bar == 1, not -10!). I've wasted 
a bit of time because of this happening.

void main() {
	if (int bar = foo() != 0) {
		assert(bar == -10);
	}
}

auto foo() {
	return -10;
}


More information about the Digitalmars-d-learn mailing list