[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65318] Deprecation warning with C++20
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #65318] Deprecation warning with C++20 |
Date: |
Thu, 15 Feb 2024 17:54:20 -0500 (EST) |
Follow-up Comment #4, bug#65318 (group octave):
Thanks for catching that. I missed that "[=, this]" should (could?) error
until C++20. All I saw was that "this" could be used and there wasn't any
standard revision mentioned for that. I didn't see that it depends on whether
the default capture is "=".
GCC does warn when I use "-std=c++17 -pedantic":
warning: explicit by-copy capture of 'this' with by-copy capture default only
available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
I also don't see a warning unless I use "-pedantic".
Note that we can't just change "[=, this]" to "[&, this]". For example, we
might be passing the lambda as a callback function for Qt and the object
referred to by "this" is expected to exist until after the callback is done
executing, references to ordinary variables from the local scope might not be
valid when the callback is executed. We can probably find a way to work
around the problem, but it looks like it will be more work than the nice C++20
solution. Ugh.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65318>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Rafael Laboissière, 2024/02/15
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/15
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, John W. Eaton, 2024/02/15
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Rik, 2024/02/15
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20,
John W. Eaton <=
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Rik, 2024/02/15
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, John W. Eaton, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, John W. Eaton, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, John W. Eaton, 2024/02/16
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Philip Nienhuis, 2024/02/17
- [Octave-bug-tracker] [bug #65318] Deprecation warning with C++20, Markus Mützel, 2024/02/19