summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/references.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-06-27 17:52:15 +0000
committerAnders Carlsson <andersca@mac.com>2010-06-27 17:52:15 +0000
commit3f48c603fbc3105f11350c397faf5fbf9d2b285d (patch)
tree5d54059a5e23a4b198b6b4f748ca4213944eb590 /clang/test/CodeGenCXX/references.cpp
parent18c205ecdfc790a9ad516bf764a9182f5ac9c9fa (diff)
downloadbcm5719-llvm-3f48c603fbc3105f11350c397faf5fbf9d2b285d.tar.gz
bcm5719-llvm-3f48c603fbc3105f11350c397faf5fbf9d2b285d.zip
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.
llvm-svn: 106983
Diffstat (limited to 'clang/test/CodeGenCXX/references.cpp')
-rw-r--r--clang/test/CodeGenCXX/references.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/references.cpp b/clang/test/CodeGenCXX/references.cpp
index ed0c6f9d2d2..d2ad9801355 100644
--- a/clang/test/CodeGenCXX/references.cpp
+++ b/clang/test/CodeGenCXX/references.cpp
@@ -160,7 +160,7 @@ const int &f2() { return 0; }
namespace N1 {
const int foo = 1;
// CHECK: @_ZN2N14test
- int test(const int& arg = foo) {
+ void test(const int& arg = foo) {
// Ensure this array is on the stack where we can set values instead of
// being a global constant.
// CHECK: %args_array = alloca
@@ -224,3 +224,37 @@ namespace N2 {
i = 19;
}
}
+
+namespace N3 {
+
+// PR7326
+
+struct A {
+ explicit A(int);
+ ~A();
+};
+
+// CHECK: define internal void @__cxx_global_var_init
+// CHECK: call void @_ZN2N31AC1Ei(%"class.N2::X"* @_ZGRN2N35sA123E, i32 123)
+// CHECK: call i32 @__cxa_atexit
+// CHECK: ret void
+const A &sA123 = A(123);
+}
+
+namespace N4 {
+
+struct A {
+ A();
+ ~A();
+};
+
+void f() {
+ // CHECK: define void @_ZN2N41fEv
+ // CHECK: call void @_ZN2N41AC1Ev(%"class.N2::X"* @_ZGRZN2N41fEvE2ar)
+ // CHECK: call i32 @__cxa_atexit
+ // CHECK: ret void
+ static const A& ar = A();
+
+}
+}
+
OpenPOWER on IntegriCloud