hokein wrote:

> A moved from object could be reinitalized:
> 
> ```
> void test() {  
>     std::vector<std::string_view> abc;  
>     std::string b;  
>     add(abc, std::move(b));  
>     b = std::string(); // now b can be used again. 
> }
> ```
> 
> That being said, maybe this is rare enough that we could have an opt-in 
> warning. But we definitely cannot have something that is on by default.
I think we are primarily concerned with pointers or references to a moved-from 
object. When the moved-from object is reinitialized, using a pointer to it can 
be very tricky and is likely undefined behavior, https://godbolt.org/z/Wh5vKe8z6

https://github.com/llvm/llvm-project/pull/125520
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to