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 | 52c0b58d33385417567a404149570fd2b6895c91 (patch) | |
tree | da657dd4afd3bd24cdce33618b73f79ded26ccda /clang/test/CodeGenCXX/temporaries.cpp | |
parent | edac22a9f3b1355c01ae4fb66958e93db2387ffb (diff) | |
download | bcm5719-llvm-52c0b58d33385417567a404149570fd2b6895c91.tar.gz bcm5719-llvm-52c0b58d33385417567a404149570fd2b6895c91.zip |
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.
llvm-svn: 167798
Diffstat (limited to 'clang/test/CodeGenCXX/temporaries.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/temporaries.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/temporaries.cpp b/clang/test/CodeGenCXX/temporaries.cpp index e90c94796fa..a369c2e3697 100644 --- a/clang/test/CodeGenCXX/temporaries.cpp +++ b/clang/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( +} |