dmd/compiler/test/fail_compilation/ice15332.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

19 lines
415 B
D

/*
TEST_OUTPUT:
---
fail_compilation/ice15332.d(16): Error: calling non-static function `fun` requires an instance of type `C`
fail_compilation/ice15332.d(17): Error: accessing non-static variable `var` requires an instance of `C`
---
*/
class C
{
int fun() { return 5; }
int var;
void test()
{
int a1 = function() { return fun; }();
int a2 = function() { return var; }();
}
}