fix #665 - The check for auto function without return doesn't handle "implicit auto functions"

This commit is contained in:
Basile Burg 2018-06-20 12:32:38 +02:00
parent 76d8a30d23
commit af252569f7
1 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,7 @@ public:
_returns[$-1] = false;
const bool autoFun = decl.storageClasses
.any!(a => a.token.type == tok!"auto");
.any!(a => a.token.type == tok!"auto" || a.atAttribute !is null);
decl.accept(this);
@ -216,6 +216,16 @@ unittest
AutoFunctionChecker.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
@property doStuff(){} // [warn]: %s
@safe doStuff(){} // [warn]: %s
@disable doStuff();
@safe void doStuff();
}c.format(
AutoFunctionChecker.MESSAGE,
AutoFunctionChecker.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
enum _genSave = "return true;";
auto doStuff(){ mixin(_genSave);}