diff options
author | David Blaikie <dblaikie@gmail.com> | 2011-11-17 06:01:57 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2011-11-17 06:01:57 +0000 |
commit | 6fe2965ce722826ae7c3af85271f900286ef20c3 (patch) | |
tree | 89e5edd980075aec80bd66a1d26fb2657f0cd880 /lib/Sema/SemaDeclCXX.cpp | |
parent | e6226ae490903717c8c07782f28bc8349543021f (diff) |
Include named unions in union member init checking
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 8aeb8fb33f..52eb9b0d3f 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3065,11 +3065,9 @@ bool CheckRedundantUnionInit(Sema &S, RedundantUnionMap &Unions) { FieldDecl *Field = Init->getAnyMember(); RecordDecl *Parent = Field->getParent(); - if (!Parent->isAnonymousStructOrUnion()) - return false; - NamedDecl *Child = Field; - do { + + while (Parent->isAnonymousStructOrUnion() || Parent->isUnion()) { if (Parent->isUnion()) { UnionEntry &En = Unions[Parent]; if (En.first && En.first != Child) { @@ -3085,11 +3083,13 @@ bool CheckRedundantUnionInit(Sema &S, En.first = Child; En.second = Init; } + if (!Parent->isAnonymousStructOrUnion()) + return false; } Child = Parent; Parent = cast<RecordDecl>(Parent->getDeclContext()); - } while (Parent->isAnonymousStructOrUnion()); + } return false; } |