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

36 lines
524 B
D

/*
TEST_OUTPUT:
---
fail_compilation/fail143.d(23): Error: calling non-static function `next` requires an instance of type `Quux`
fail_compilation/fail143.d(30): Error: template instance `fail143.Foo!int` error instantiating
---
*/
class Quux
{
uint x;
final uint next()
{
return x;
}
}
template Foo(T)
{
void bar()
{
int r = Quux.next;
}
}
int main(char[][] args)
{
auto prng = new Quux();
alias Foo!(int).bar baz;
int x = prng.next;
baz();
return 0;
}