octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65318] Deprecation warning with C++20


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20
Date: Thu, 15 Feb 2024 11:54:42 -0500 (EST)

Follow-up Comment #1, bug#65318 (group octave):

It's probably good to have that warning now. I guess we never intended to make
copies for that lambda. But maybe we didn't make copies because `this` was
captured differently by `[=]` before (i.e., by reference on not by copy)?

Anyway, the following change might fix that and make our intensions clearer
(untested):

diff -r 92a2e883af17 liboctave/array/Range.h
--- a/liboctave/array/Range.h   Wed Feb 14 15:07:28 2024 +0100
+++ b/liboctave/array/Range.h   Thu Feb 15 17:43:39 2024 +0100
@@ -251,7 +251,7 @@
 
         T *array = retval.rwdata ();
 
-        idx.loop (n, [=, &array] (octave_idx_type i)
+        idx.loop (n, [&] (octave_idx_type i)
         {
           if (i == 0)
             // Required for proper NaN handling.


I'll leave that for someone to review in case I misunderstood.

Maybe, there are more places in the code that would need similar changes?



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65318>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]