diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-25 01:54:38 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-25 01:54:38 +0000 |
commit | e1883100a395180465b007c12860c124a6994101 (patch) | |
tree | 02a0b3d59e6d62164b2e1b888fa0f9d324b97039 /clang/test/SemaCXX/empty-class-layout.cpp | |
parent | 0cf155174e6cf5a4a2cb80a17c5060196a54bbee (diff) | |
download | bcm5719-llvm-e1883100a395180465b007c12860c124a6994101.tar.gz bcm5719-llvm-e1883100a395180465b007c12860c124a6994101.zip |
Who would have thought that empty classes were so tricky? Handle cases where an empty virtual base class needs to be moved aside because it conflicts with the first field.
llvm-svn: 82746
Diffstat (limited to 'clang/test/SemaCXX/empty-class-layout.cpp')
-rw-r--r-- | clang/test/SemaCXX/empty-class-layout.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/empty-class-layout.cpp b/clang/test/SemaCXX/empty-class-layout.cpp index fbe2cbe6b46..09e7e4e3733 100644 --- a/clang/test/SemaCXX/empty-class-layout.cpp +++ b/clang/test/SemaCXX/empty-class-layout.cpp @@ -28,4 +28,18 @@ SA(4, sizeof(I) == 2); struct J : Empty { Empty e[2]; }; -SA(5, sizeof(J) == 3);
\ No newline at end of file +SA(5, sizeof(J) == 3); + +template<int N> struct Derived : Empty, Derived<N - 1> { +}; +template<> struct Derived<0> : Empty { }; + +struct S1 : virtual Derived<10> { + Empty e; +}; +SA(6, sizeof(S1) == 24); + +struct S2 : virtual Derived<10> { + Empty e[2]; +}; +SA(7, sizeof(S2) == 24); |