fix, dont emit warn for body-less functions

This commit is contained in:
Basile Burg 2016-11-26 08:31:43 +01:00
parent cbeca3ba34
commit e041f6e5dd
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 15 additions and 1 deletions

View File

@ -52,7 +52,7 @@ public:
decl.accept(this);
if (autoFun && !_returns[$-1])
if (decl.functionBody && autoFun && !_returns[$-1])
addErrorMessage(decl.name.line, decl.name.column, KEY, MESSAGE);
}
@ -149,5 +149,19 @@ unittest
AutoFunctionChecker.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
auto doStuff(){} // [warn]: %s
extern(C) auto doStuff();
}c.format(
AutoFunctionChecker.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
auto doStuff(){} // [warn]: %s
@disable auto doStuff();
}c.format(
AutoFunctionChecker.MESSAGE,
), sac);
stderr.writeln("Unittest for AutoFunctionChecker passed.");
}