summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/cxx0x-initializer-references.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-04-09 16:09:29 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-04-09 16:09:29 +0000
commitb151ee84767d064394c94649231e79eb1bd7d72f (patch)
tree07827dd564f79b6d47ce90e60956cebb76e12612 /test/CodeGenCXX/cxx0x-initializer-references.cpp
parentd2eccb2430fadfc0ee144d7c34a042494c68a9be (diff)
[CodeGen] When promoting a reference temporary to a global use the inner type to fold it.
The MaterializeTemporaryExpr can have a different type than the inner expression, miscompiling the constant. PR23165. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx0x-initializer-references.cpp')
-rw-r--r--test/CodeGenCXX/cxx0x-initializer-references.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cxx0x-initializer-references.cpp b/test/CodeGenCXX/cxx0x-initializer-references.cpp
index d4a8f20f35..bdc97b5bd5 100644
--- a/test/CodeGenCXX/cxx0x-initializer-references.cpp
+++ b/test/CodeGenCXX/cxx0x-initializer-references.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -std=c++11 -S -triple armv7-none-eabi -emit-llvm -o - %s | FileCheck %s
+// CHECK: private constant { i8** } { i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN7PR2316510ChildClassE, i64 0, i64 2) }, align 4
+
namespace reference {
struct A {
int i1, i2;
@@ -79,3 +81,22 @@ namespace reference {
}
}
+
+namespace PR23165 {
+struct AbstractClass {
+ virtual void foo() const = 0;
+};
+
+struct ChildClass : public AbstractClass {
+ virtual void foo() const {}
+};
+
+void helper(const AbstractClass &param) {
+ param.foo();
+}
+
+void foo() {
+// CHECK: call void @_ZN7PR231656helperERKNS_13AbstractClassE(%{{.*}} bitcast ({ i8** }* @{{.*}} to %{{.*}}*))
+ helper(ChildClass());
+}
+}