Skip to content

Commit

Permalink
fix Issue 15411 - Function literal accessing variable in declaration …
Browse files Browse the repository at this point in the history
…scope produces bad error message with inline call
  • Loading branch information
9rnsr committed Feb 1, 2016
1 parent c80bfca commit 0305ce7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/fail_compilation/diag15411.d
@@ -0,0 +1,15 @@
// REQUIRED_ARGS: -o-
/*
TEST_OUTPUT:
---
fail_compilation/diag15411.d(13): Error: function diag15411.test15411.__funcliteral1 cannot access frame of function diag15411.test15411
fail_compilation/diag15411.d(14): Error: function diag15411.test15411.__funcliteral2 cannot access frame of function diag15411.test15411
---
*/

void test15411()
{
auto i = 0;
auto j = (function() { return i; })();
auto f = function() { return i; };
}

0 comments on commit 0305ce7

Please sign in to comment.