code-d
code-d copied to clipboard
Local functions in constructor are perceived as member functions
I'm having a similar problem as here, but it's even simpler. I assume the fix has not been merged into serve-d yet, or does it not cover my case?
Consider this code:
class A
{
this()
{
void b() {}
b();
}
}
It squiggles b(); as warning:
a virtual call inside a constructor may lead to unexpected results in the derived classes.
are you using serve-d nightly?
@WebFreak001 Yes
I think that fix might not cover your issue there, happens for me too and I know I'm using the latest tagged dscanner release.
yes tested with dscanner ~master and the issue is there
On a related note, the following code gives the same warning for a();:
class A
{
static void delegate() b;
void a() {}
this()
{
b = () { a(); };
}
}
But if I change a() to this.a(), it doesn't.
I wonder if that is intentional, because this.a() is less ambiguous.