================
@@ -372,6 +421,19 @@ void no_error_if_dangle_then_rescue_gsl() {
   v.use();     // This is safe.
 }
 
+void no_error_loan_from_current_iteration(bool cond) {
+  // See https://github.com/llvm/llvm-project/issues/156959.
+  MyObj b;
+  while (cond) {
+    MyObj a;
+    View p = b;
+    if (cond) {
+      p = a;
+    }
+    (void)p;
----------------
ymand wrote:

Does this count as a use? Unlike `*p`, it's not obviously using the contents of 
`p`. Would `p.use()` be more appropriate?

https://github.com/llvm/llvm-project/pull/159991
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to