This should work for the same reason that template functions get their attributes inferred:
template Mine()
{
void foo()
{
}
}
@safe bar()
{
Mine!().foo();
}
dmd test5
test.d(11): Error: safe function 'test.bar' cannot call system function 'test.Mine!().foo'
Comment #2 by destructionator — 2022-08-01T23:53:27Z
I just encountered this while confirming a report on the chat room:
```
template A() {
void foo() { }
auto bar() { }
}
static assert(is(typeof(A!().foo) == typeof(A!().bar)));
```
Fails today due to this issue. Bizarre.
Comment #3 by robert.schadek — 2024-12-13T18:48:25Z