diff --git a/src/dscanner/analysis/vcall_in_ctor.d b/src/dscanner/analysis/vcall_in_ctor.d index 820b4de..e2a0f6d 100644 --- a/src/dscanner/analysis/vcall_in_ctor.d +++ b/src/dscanner/analysis/vcall_in_ctor.d @@ -162,6 +162,18 @@ public: popNestedFunc(); } + override void visit(const(StructDeclaration) decl) + { + pushVirtual(false); + pushInClass(false); + pushNestedFunc(false); + decl.accept(this); + check(); + popVirtual(); + popInClass(); + popNestedFunc(); + } + override void visit(const(Constructor) ctor) { pushInCtor(isInClass); @@ -404,6 +416,18 @@ unittest } }, sac); + assertAnalyzerWarnings(q{ + class C { + static struct S { + public: + this(int) { + foo(); + } + void foo() {} + } + } + }, sac); + import std.stdio: writeln; writeln("Unittest for VcallCtorChecker passed"); }