mirror of https://github.com/microsoft/clang.git
A base subobject type doesn't make sense for unions; don't try to compute it. Based on patch by Yin Ma. Fixes PR11751.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9ec0ef31c3
commit
89e6e85f1a
|
@ -997,7 +997,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D,
|
|||
|
||||
// If we're in C++, compute the base subobject type.
|
||||
llvm::StructType *BaseTy = 0;
|
||||
if (isa<CXXRecordDecl>(D)) {
|
||||
if (isa<CXXRecordDecl>(D) && !D->isUnion()) {
|
||||
BaseTy = Builder.BaseSubobjectType;
|
||||
if (!BaseTy) BaseTy = Ty;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -o - %s
|
||||
|
||||
union sigval { };
|
||||
union sigval Test1;
|
||||
|
||||
union sigval sigev_value;
|
||||
|
||||
int main()
|
||||
{
|
||||
return sizeof(sigev_value);
|
||||
}
|
||||
union NonPODUnion { ~NonPODUnion(); };
|
||||
union NonPODUnion Test2;
|
||||
|
|
Loading…
Reference in New Issue