forked from OSchip/llvm-project
Fix an assertion when initializing a union using a member initializer. (We weren't casting from the union type to the initializer type correctly).
llvm-svn: 80837
This commit is contained in:
parent
3a964ebdc4
commit
35dca26835
|
@ -1658,7 +1658,8 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) {
|
|||
else {
|
||||
// Initializing an anonymous union data member.
|
||||
FieldDecl *anonMember = Member->getAnonUnionMember();
|
||||
LHS = EmitLValueForField(LHS.getAddress(), anonMember, false, 0);
|
||||
LHS = EmitLValueForField(LHS.getAddress(), anonMember,
|
||||
/*IsUnion=*/true, 0);
|
||||
FieldType = anonMember->getType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: clang-cc -emit-llvm -o - %s
|
||||
|
||||
struct A {
|
||||
union {
|
||||
int a;
|
||||
void* b;
|
||||
};
|
||||
|
||||
A() : a(0) { }
|
||||
};
|
||||
|
||||
A a;
|
Loading…
Reference in New Issue