Merge pull request #667 from BBasile/issue-666

fix #666 - False positive for "trust too much"
This commit is contained in:
Sebastian Wilzbach 2018-06-20 18:43:09 +02:00 committed by GitHub
commit 2a565a87ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.");
}