<rdar://problem/13185264> Don't crash when attempting to redundantly initialize a member of an anonymous union.

llvm-svn: 177941
This commit is contained in:
Douglas Gregor 2013-03-25 23:28:23 +00:00
parent 677ce95a08
commit ea306a14f4
2 changed files with 9 additions and 1 deletions

View File

@ -3436,7 +3436,7 @@ bool CheckRedundantInit(Sema &S,
return false; return false;
} }
if (FieldDecl *Field = Init->getMember()) if (FieldDecl *Field = Init->getAnyMember())
S.Diag(Init->getSourceLocation(), S.Diag(Init->getSourceLocation(),
diag::err_multiple_mem_initialization) diag::err_multiple_mem_initialization)
<< Field->getDeclName() << Field->getDeclName()

View File

@ -90,3 +90,11 @@ namespace test5 {
} }
}; };
} }
namespace rdar13185264 {
class X {
X() : a(), // expected-note{{previous initialization is here}}
a() { } // expected-error{{multiple initializations given for non-static member 'a'}}
union { void *a; };
};
}