diff options
author | Anders Carlsson <andersca@mac.com> | 2010-06-27 17:52:15 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-06-27 17:52:15 +0000 |
commit | 045a6d84a0fa672eb5d914be1bb8f3baa226beb3 (patch) | |
tree | f4f9c23d97304f2de76d8e94479eea78991e5fbc /test/CodeGenCXX/references.cpp | |
parent | 656746cd8c3a45901bcdec89ca1eb4495ee79b36 (diff) |
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/references.cpp')
-rw-r--r-- | test/CodeGenCXX/references.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp index ed0c6f9d2d..d2ad980135 100644 --- a/test/CodeGenCXX/references.cpp +++ b/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(); + +} +} + |