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

22 lines
371 B
D

/*
TEST_OUTPUT:
---
fail_compilation/bug8891.d(21): Error: calling non-static function `opCall` requires an instance of type `S`
---
*/
struct S
{
int value = 10;
S opCall(int n) // non-static
{
//printf("this.value = %d\n", this.value); // prints garbage!
S s;
s.value = n;
return s;
}
}
void main()
{
S s = 10;
}