fix #666 - False positive for "trust too much"

This commit is contained in:
Basile Burg 2018-06-20 12:08:39 +02:00
parent 76d8a30d23
commit a864eaafb7
1 changed files with 10 additions and 1 deletions

View File

@ -57,7 +57,11 @@ public:
override void visit(const Declaration d)
{
const oldCheckAtAttribute = checkAtAttribute;
checkAtAttribute = d.functionDeclaration is null;
checkAtAttribute = d.functionDeclaration is null && d.unittest_ is null &&
d.constructor is null && d.destructor is null &&
d.staticConstructor is null && d.staticDestructor is null &&
d.sharedStaticConstructor is null && d.sharedStaticDestructor is null;
d.accept(this);
checkAtAttribute = oldCheckAtAttribute;
}
@ -145,5 +149,10 @@ unittest
alias nothrow @trusted uint F4();
}c , sac);
assertAnalyzerWarnings(q{
@trusted ~this();
@trusted this();
}c , sac);
stderr.writeln("Unittest for TrustTooMuchCheck passed.");
}