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

23 lines
417 B
D

/*
TEST_OUTPUT:
---
fail_compilation/fail301.d(11): Error: accessing non-static variable `guard` requires an instance of `bug3305b`
fail_compilation/fail301.d(22): Error: template instance `fail301.bug3305!0` error instantiating
---
*/
struct bug3305(alias X = 0)
{
auto guard = bug3305b!(0).guard;
}
struct bug3305b(alias X = 0)
{
bug3305!(X) goo;
auto guard = 0;
}
void test()
{
bug3305!(0) a;
}