diff options
author | Warren Hunt <whunt@google.com> | 2014-04-25 21:56:30 +0000 |
---|---|---|
committer | Warren Hunt <whunt@google.com> | 2014-04-25 21:56:30 +0000 |
commit | f0ffdb2e6014987e16e685d96adaf09f3261a2f3 (patch) | |
tree | 53e109fada1cf26aa812d1d1604d9b1d66b19f7e /clang/test/CodeGenCXX/class-layout.cpp | |
parent | fd1bc602b31c2acdd8cba6be835b9bba5d424af6 (diff) | |
download | bcm5719-llvm-f0ffdb2e6014987e16e685d96adaf09f3261a2f3.tar.gz bcm5719-llvm-f0ffdb2e6014987e16e685d96adaf09f3261a2f3.zip |
Fixed Assert In CGRecordLowering
Prior to this patch, CGRecordLower assumed that virtual bases could not
be placed before the nvsize of an object. This isn't true in Itanium
mode, virtual bases are placed at dsize rather than vnsize and in the
case of zero sized non-virtual bases nvsize can be larger than dsize.
This patch fixes CGRecordLowering to avoid an assert and to clip
bitfields properly in this case. A test case is included.
llvm-svn: 207280
Diffstat (limited to 'clang/test/CodeGenCXX/class-layout.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/class-layout.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/class-layout.cpp b/clang/test/CodeGenCXX/class-layout.cpp index 1f6212949fd..c6aaf0f0460 100644 --- a/clang/test/CodeGenCXX/class-layout.cpp +++ b/clang/test/CodeGenCXX/class-layout.cpp @@ -91,3 +91,12 @@ namespace Test7 { B* b; #pragma pack () } + +// Shouldn't crash. +namespace Test8 { + struct A {};
+ struct D { int a; };
+ struct B : virtual D, A { };
+ struct C : B, A { void f() {} };
+ C c;
+} |