Skip to content

Commit

Permalink
Fix warning for class defined in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladiwostok committed Dec 3, 2023
1 parent 8f953ab commit 47ff22c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/dscanner/analysis/vcall_in_ctor.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ extern (C++) class VcallCtorChecker(AST) : BaseAnalyzerDmd
foreach (member; *classDecl.members)
{
if (member.isCtorDeclaration())
{
ctorLevel++;

member.accept(this);

if (member.isCtorDeclaration())
member.accept(this);
ctorLevel--;
}
}
}
}
Expand Down Expand Up @@ -93,6 +92,20 @@ unittest
}
}c.format(MSG, MSG), sac, true);

assertAnalyzerWarningsDMD(q{
class D
{
this(int a)
{
class T
{
void bar() {}
void foobar () { bar(); }
}
}
}
}c, sac, true);

assertAnalyzerWarningsDMD(q{
class Foo
{
Expand Down

0 comments on commit 47ff22c

Please sign in to comment.