Skip to content

Conversation

@2LoS
Copy link
Contributor

@2LoS 2LoS commented Feb 4, 2025

No description provided.

@2LoS 2LoS requested a review from a team as a code owner February 4, 2025 17:16
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Feb 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 4, 2025

@llvm/pr-subscribers-libcxx

Author: LoS (2LoS)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/125723.diff

1 Files Affected:

  • (modified) libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp (+3-3)
diff --git a/libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp b/libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp
index c89d6f5a229e8a..e39881a5e5a3ba 100644
--- a/libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp
+++ b/libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp
@@ -159,7 +159,7 @@ class LifetimeIterator {
       assert(!rhs.moved_from_);
       rhs.moved_from_ = true;
 
-      *v_ = *rhs.v_;
+      *v_ = std::move(*rhs.v_);
       moved_from_ = false;
 
       return *this;
@@ -368,7 +368,7 @@ class ConstexprIterator {
     constexpr Reference(const Reference& rhs) = default;
     constexpr Reference& operator=(const Reference& rhs) {
       assert(!rhs.moved_from_);
-      v_ = rhs.v_;
+      *v_ = *rhs.v_;
       moved_from_ = false;
 
       return *this;
@@ -384,7 +384,7 @@ class ConstexprIterator {
       rhs.moved_from_ = true;
       moved_from_ = false;
 
-      v_ = rhs.v_;
+      *v_ = std::move(*rhs.v_);
       return *this;
     }
 

@github-actions
Copy link

github-actions bot commented Feb 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@mordante
Copy link
Member

mordante commented Feb 4, 2025

Thanks for your patch! Can you please add a description explaining what this patch tries to fix?

@2LoS
Copy link
Contributor Author

2LoS commented Feb 5, 2025

@mordante , the patch fixes the implementation of some copy and move assignment operators for the Reference class: they assigned pointers-to-object; now, they assign the objects themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants