fix false warning on top level struct/union

This commit is contained in:
Basile Burg 2017-01-16 17:07:14 +01:00
parent 9b97b7d929
commit d9b6828205
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
1 changed files with 9 additions and 1 deletions

View File

@ -159,7 +159,7 @@ public:
if (d.classDeclaration || d.structDeclaration || d.unionDeclaration)
{
_finalAggregate = isFinal;
if (savedParent == Parent.module_)
if (_finalAggregate && savedParent == Parent.module_)
{
if (d.structDeclaration)
addError(d.structDeclaration, MESSAGE.struct_i);
@ -224,6 +224,14 @@ public:
void foo(){void foo(){}}
}, sac);
assertAnalyzerWarnings(q{
struct S{}
}, sac);
assertAnalyzerWarnings(q{
union U{}
}, sac);
assertAnalyzerWarnings(q{
class Foo{public final void foo(){}}
}, sac);