summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/empty-class-layout.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-12-06 03:04:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-12-06 03:04:50 +0000
commit7808c6aa7e929486c289608edb1f9a1efc3e5c8a (patch)
treefac97e82750d941df4f4159cb01fa80856fb44f1 /clang/test/SemaCXX/empty-class-layout.cpp
parent7964ab5e49d25cfd16c51cee9911f6b036ac488c (diff)
downloadbcm5719-llvm-7808c6aa7e929486c289608edb1f9a1efc3e5c8a.tar.gz
bcm5719-llvm-7808c6aa7e929486c289608edb1f9a1efc3e5c8a.zip
Don't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscure record layout bug.
llvm-svn: 169467
Diffstat (limited to 'clang/test/SemaCXX/empty-class-layout.cpp')
-rw-r--r--clang/test/SemaCXX/empty-class-layout.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/empty-class-layout.cpp b/clang/test/SemaCXX/empty-class-layout.cpp
index 951f16c1b0c..3cfc491ef66 100644
--- a/clang/test/SemaCXX/empty-class-layout.cpp
+++ b/clang/test/SemaCXX/empty-class-layout.cpp
@@ -156,3 +156,18 @@ namespace Test7 {
};
SA(0, sizeof(Test) == 2);
}
+
+namespace Test8 {
+ // Test that type sugar doesn't make us incorrectly determine the size of an
+ // array of empty classes.
+ struct Empty1 {};
+ struct Empty2 {};
+ struct Empties : Empty1, Empty2 {};
+ typedef Empty1 Sugar[4];
+ struct A : Empty2, Empties {
+ // This must go at offset 2, because if it were at offset 0,
+ // V[0][1] would overlap Empties::Empty1.
+ Sugar V[1];
+ };
+ SA(0, sizeof(A) == 6);
+}
OpenPOWER on IntegriCloud