Skip to content

Commit

Permalink
fix Issue 14049 - Wrong purity inference for nested lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jan 26, 2015
1 parent 0acb94c commit 91bd4eb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/fail_compilation/testInference.d
Expand Up @@ -133,3 +133,23 @@ immutable(void)* g10063(inout int* p) pure
{
return f10063(p);
}

/*
TEST_OUTPUT:
---
fail_compilation/testInference.d(154): Error: pure function 'testInference.bar14049' cannot call impure function 'testInference.foo14049!int.foo14049'
---
*/
auto impure14049() { return 1; }

void foo14049(T)(T val)
{
auto n = () @trusted {
return impure14049();
}();
}

void bar14049() pure
{
foo14049(1);
}

0 comments on commit 91bd4eb

Please sign in to comment.