Implicitly cast return expression to inferenced return type of a literal function.

The commit fixes a segfault when compiling a code similar to:
  float delegate() d = { return 1.0; };
This commit is contained in:
Alexey Prokhin
2012-04-21 16:54:38 +04:00
parent 1bd4e725e8
commit 0e54278c5a

View File

@@ -3859,7 +3859,11 @@ Statement *ReturnStatement::semantic(Scope *sc)
//printf("m1 = %d, m2 = %d\n", m1, m2);
if (m1 && m2)
#if IN_LLVM
exp = exp->implicitCastTo(sc, tret);
#else
;
#endif
else if (!m1 && m2)
tf->next = exp->type;
else if (m1 && !m2)