[Issue 10810] wrong forward reference error when using return type deduction and a cyclic call flow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 3 06:14:00 PDT 2017


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

--- Comment #8 from timon.gehr at gmx.ch ---
(In reply to Vladimir Panteleev from comment #7)
> (In reply to timon.gehr from comment #6)
> > The compiler does not know whether there are any return statements in the
> > body when starting the analysis of a function because of conditional
> > compilation and string mixins.
> 
> Are you saying that the compiler knows that a calls b, but doesn't know that
> a doesn't have any return statements?

What I'm saying is that you cannot short-circuit semantic analysis of function
bodies based on unknown information. How would the compiler determine that
there are no return statements in a's body?

E.g.:

auto a(){ auto y = b(); mixin(foo(y)); } // whether a returns depends on the
return type of b.

--


More information about the Digitalmars-d-bugs mailing list