diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-13 00:54:12 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-11-13 00:54:12 +0000 |
commit | 044c8aa39d582ebc6bca1720c65ddd06fb27780c (patch) | |
tree | 0a83266368cc275bf32a755e11b708ee1f6b4176 /test/CodeGenCXX/temporaries.cpp | |
parent | d449c792d98f58277e02c0ddc8330cd9de5f82f5 (diff) |
Fix some wrong-code bugs in implicitly-defined assignment operators:
- In C++11, perform overload resolution over all assignment operators, rather than just looking for copy/move assignment operators.
- Clean up after temporaries produced by operator= immediately, rather than accumulating them until the end of the function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/temporaries.cpp')
-rw-r--r-- | test/CodeGenCXX/temporaries.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp index e90c94796f..a369c2e369 100644 --- a/test/CodeGenCXX/temporaries.cpp +++ b/test/CodeGenCXX/temporaries.cpp @@ -537,3 +537,24 @@ namespace PR11365 { (void) (A [3]) {}; } } + +namespace AssignmentOp { + struct A { ~A(); }; + struct B { A operator=(const B&); }; + struct C : B { B b1, b2; }; + // CHECK: define void @_ZN12AssignmentOp1fE + void f(C &c1, const C &c2) { + // CHECK: call {{.*}} @_ZN12AssignmentOp1CaSERKS0_( + c1 = c2; + } + + // Ensure that each 'A' temporary is destroyed before the next subobject is + // copied. + // CHECK: define {{.*}} @_ZN12AssignmentOp1CaSERKS0_( + // CHECK: call {{.*}} @_ZN12AssignmentOp1BaSERKS + // CHECK: call {{.*}} @_ZN12AssignmentOp1AD1Ev( + // CHECK: call {{.*}} @_ZN12AssignmentOp1BaSERKS + // CHECK: call {{.*}} @_ZN12AssignmentOp1AD1Ev( + // CHECK: call {{.*}} @_ZN12AssignmentOp1BaSERKS + // CHECK: call {{.*}} @_ZN12AssignmentOp1AD1Ev( +} |