Skip to content

Commit

Permalink
Merge pull request #9360 from Basile-z/issue-19523
Browse files Browse the repository at this point in the history
fix issue 19523 - "undefined identifier" causes DMD crash
merged-on-behalf-of: Jacob Carlborg <jacob-carlborg@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Feb 14, 2019
2 parents c2c6b4b + 2b317b9 commit 3887c00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dmd/expression.d
Expand Up @@ -3694,6 +3694,9 @@ extern (C++) final class FuncExp : Expression
TypeFunction tfx = cast(TypeFunction)fd.type;
bool convertMatch = (type.ty != to.ty);

if (tfx.ty == Terror)
return MATCH.nomatch;

if (fd.inferRetType && tfx.next.implicitConvTo(tof.next) == MATCH.convert)
{
/* If return type is inferred and covariant return,
Expand Down
19 changes: 19 additions & 0 deletions test/fail_compilation/b19523.d
@@ -0,0 +1,19 @@
/*
TEST_OUTPUT:
---
fail_compilation/b19523.d(12): Error: undefined identifier `SomeStruct`
fail_compilation/b19523.d(13): Error: function `b19523.foo(int delegate() arg)` is not callable using argument types `(_error_)`
fail_compilation/b19523.d(13): cannot pass argument `__lambda1` of type `_error_` to parameter `int delegate() arg`
---
*/
module b19523;

void bar () {
SomeStruct s;
foo({
return s;
});
}

void foo (int delegate() arg) {}

0 comments on commit 3887c00

Please sign in to comment.