2 changes: 1 addition & 1 deletion test/fail_compilation/diag9831.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag9831.d(12): Error: cannot match delegate literal to function pointer type 'int function(int x)'
fail_compilation/diag9831.d(12): Error: function diag9831.main.__lambda1 cannot access frame of function D main
---
*/

Expand Down
4 changes: 2 additions & 2 deletions test/fail_compilation/fail11545.d
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail11545.d(17): Error: cannot implicitly convert expression (__lambda5) of type int delegate() pure nothrow @nogc @safe to int function()
fail_compilation/fail11545.d(17): Error: cannot implicitly convert expression (__lambda5) of type int delegate() pure nothrow @nogc @safe to int function()
fail_compilation/fail11545.d(14): Error: need 'this' for 'x' of type 'int'
fail_compilation/fail11545.d(18): Error: need 'this' for 'x' of type 'int'
---
*/

Expand Down
4 changes: 2 additions & 2 deletions test/fail_compilation/fail120.d
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail120.d(12): Error: non-constant nested delegate literal expression __lambda4
fail_compilation/fail120.d(13): Error: non-constant nested delegate literal expression __lambda5
fail_compilation/fail120.d(12): Error: need 'this' for 'nodes' of type 'int[2]'
fail_compilation/fail120.d(13): Error: need 'this' for 'nodes' of type 'int[2]'
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/fail39.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail39.d(11): Error: function fail39.main.foo is a nested function and cannot be accessed from fail39.main.__funcliteral2
fail_compilation/fail39.d(11): Error: function fail39.main.__funcliteral2 cannot access frame of function D main
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/ice10922.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice10922.d(9): Error: delegate ice10922.__lambda4 (const(uint) n) is not callable using argument types ()
fail_compilation/ice10922.d(9): Error: function ice10922.__lambda4 (const(uint) n) is not callable using argument types ()
---
*/

Expand Down
6 changes: 2 additions & 4 deletions test/fail_compilation/ice11850.d
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice11850.d(16): Error: incompatible types for ((a) < ([0])): 'uint[]' and 'int[]'
fail_compilation/ice11850.d(14): Error: incompatible types for ((a) < ([0])): 'uint[]' and 'int[]'
fail_compilation/imports/a11850.d(9): instantiated from here: FilterResult!(__lambda1, uint[][])
fail_compilation/ice11850.d(16): instantiated from here: filter!(uint[][])
fail_compilation/ice11850.d(14): instantiated from here: filter!(uint[][])
---
*/



import imports.a11850 : filter;

void main()
Expand Down
19 changes: 19 additions & 0 deletions test/fail_compilation/ice15332.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice15332.d(16): Error: need 'this' for 'fun' of type 'int()'
fail_compilation/ice15332.d(17): Error: need 'this' for 'var' of type 'int'
---
*/

class C
{
int fun() { return 5; }
int var;

void test()
{
int a1 = function() { return fun; }();
int a2 = function() { return var; }();
}
}
5 changes: 5 additions & 0 deletions test/runnable/funclit.d
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ void test4v()
static assert(!__traits(compiles, { tcvarg4(0, a => a); }));
}

// A lambda in function default argument should be deduced to delegate, by the
// preparation inferType call in TypeFunction.semantic.
void test4_findRoot(scope bool delegate(real lo, real hi) tolerance = (real a, real b) => false)
{}

/***************************************************/
// on CallExp::e1

Expand Down