[Issue 14534] Front-end should lower all non-scalar condition expressions
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon May 4 04:37:31 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14534
--- Comment #4 from yebblies <yebblies at gmail.com> ---
(In reply to Iain Buclaw from comment #3)
> In some cases, yes. But in this instance, I don't think so.
>
> After we've verified condition->toBoolean() the only other time semantic
> analysis is done on the condition is for optimizations. And I seriously
> doubt that we are likely going to get any meaningful constant literal
> optimized out from any of these types.
One example is error messages - I would much rather see
if (dg)
than
if ((auto tmp = dg, tmp.funcptr != null && tmp.ptr != null))
Lowering to
if (cast(bool)dg)
would be acceptable, but the lowering would still be in the backend. Maybe
this is done late enough that it wouldn't affect error messages anyway?
--
More information about the Digitalmars-d-bugs
mailing list