mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 14:07:28 +08:00
A base subobject type doesn't make sense for unions; don't try to compute it. Based on patch by Yin Ma. Fixes PR11751.
llvm-svn: 148093
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user