[Issue 21748] Return value of forward-referenced auto ref function mistakenly treated as lvalue
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 28 11:04:40 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21748
--- Comment #3 from uplink.coder at googlemail.com ---
This diff would fix it in a hacky way!
BUT that does not address the systemic issue that the ast is in unstable states
depending on resolve ordering!
--- a/src/dmd/expression.d
+++ b/src/dmd/expression.d
@@ -5081,6 +5081,24 @@ extern (C++) final class CallExp : UnaExp
if (tb.ty == Tdelegate || tb.ty == Tpointer)
tb = tb.nextOf();
auto tf = tb.isTypeFunction();
+
+ // the real ref-ness of the function might not be inferred yet
+ // therefore we need to get the function out if there is one
+ if (tf)
+ {
+ if (auto ve = e1.isVarExp())
+ {
+ if (ve.var)
+ {
+ if (auto fd = ve.var.isFuncDeclaration())
+ {
+ fd.functionSemantic();
+ fd.functionSemantic3();
+ }
+ }
+ }
+ }
--
More information about the Digitalmars-d-bugs
mailing list