forked from OSchip/llvm-project
<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:
parent
677ce95a08
commit
ea306a14f4
|
@ -3436,7 +3436,7 @@ bool CheckRedundantInit(Sema &S,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (FieldDecl *Field = Init->getMember())
|
||||
if (FieldDecl *Field = Init->getAnyMember())
|
||||
S.Diag(Init->getSourceLocation(),
|
||||
diag::err_multiple_mem_initialization)
|
||||
<< Field->getDeclName()
|
||||
|
|
|
@ -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; };
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue