dmd/compiler/test/fail_compilation/fail11545.d
Dennis c4e84f226e
Improve "need this" error (#15430)
* Improve "need `this`" error for function calls

* Improve "need `this`" error for member variables

* Improve "need this" error for address of variable

* Remove dead error
2023-07-20 12:41:02 +03:00

20 lines
377 B
D

/*
TEST_OUTPUT:
---
fail_compilation/fail11545.d(14): Error: accessing non-static variable `x` requires an instance of `C`
fail_compilation/fail11545.d(18): Error: accessing non-static variable `x` requires an instance of `C`
---
*/
class C
{
int x = 42;
int function() f1 = function() {
return x;
};
int function() f2 = {
return x;
};
}