mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-27 10:03:13 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user