# HG changeset patch # User John W. Eaton # Date 1708112574 18000 # Node ID 49128bdb9eb230d1fa50b7e1bf90853db058d3a5 # Parent 7de59b26cf79af92668a3b573ccc54feb4006805 use explicit lambda-expression captures (bug #65318) Previously, we recommended using implicit capture by value (if possible) in all lambda expressions in Octave. However, this choice causes trouble in the transition period leading up to C++20, when the meaning changes for capturing 'this' by reference when the default capture is '='. Since all lambda expressions in Octave only need to capture a few variables it seems better and relatively easy to simply name all captured variable explicitly. (The maximum number of captured variables currently appears to be seven, including 'this', but the vast majority are capturing just one or two.) Affected files: Canvas.cc, GLCanvas.cc, QTerminal.cc, command-widget.cc, documentation.cc, files-dock-widget.cc, interpreter-qobject.cc, file-editor-tab.cc, file-editor.cc, octave-qscintilla.cc, main-window.cc, octave-dock-widget.cc, octave-qobject.cc, set-path-model.cc, settings-dialog.cc, variable-editor-model.cc, variable-editor.cc, call-stack.cc, gl2ps-print.cc, graphics.cc, input.cc, interpreter.cc, load-path.cc, mex.cc, pr-output.cc, strfns.cc, sysdep.cc, __delaunayn__.cc, audiodevinfo.cc, audioread.cc, oct-parse.yy, pt-eval.cc, Array-util.cc, Range.h, lo-sysdep.cc, lo-regexp.cc, oct-glob.cc, oct-string.cc, and url-transfer.cc. diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/graphics/Canvas.cc --- a/libgui/graphics/Canvas.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/graphics/Canvas.cc Fri Feb 16 14:42:54 2024 -0500 @@ -902,7 +902,7 @@ props.prepend (figObj.get_handle ().as_octave_value ()); emit interpreter_event - ([=] (octave::interpreter& interp) + ([this, props] (octave::interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/graphics/GLCanvas.cc --- a/libgui/graphics/GLCanvas.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/graphics/GLCanvas.cc Fri Feb 16 14:42:54 2024 -0500 @@ -69,7 +69,7 @@ { begin_rendering (); - unwind_action reset_current ([=] () { end_rendering (); }); + unwind_action reset_current ([this] () { end_rendering (); }); graphics_object fig = go.get_ancestor ("figure"); double dpr = fig.get ("__device_pixel_ratio__").double_value (); @@ -94,7 +94,7 @@ begin_rendering (); - unwind_action reset_current ([=] () { end_rendering (); }); + unwind_action reset_current ([this] () { end_rendering (); }); // When the figure is not visible or its size is frozen for printing, // we use a framebuffer object to make sure we are rendering on a @@ -108,7 +108,7 @@ fbo.bind (); - unwind_action release_fbo ([&] () { fbo.release (); }); + unwind_action release_fbo ([&fbo] () { fbo.release (); }); m_renderer.set_viewport (pos(2), pos(3)); m_renderer.set_device_pixel_ratio (dpr); @@ -137,7 +137,7 @@ { begin_rendering (); - unwind_action reset_current ([=] () { end_rendering (); }); + unwind_action reset_current ([this] () { end_rendering (); }); graphics_object fig (go.get_ancestor ("figure")); @@ -159,7 +159,7 @@ fbo.bind (); - unwind_action release_fbo ([&] () { fbo.release (); }); + unwind_action release_fbo ([&fbo] () { fbo.release (); }); octave::gl2ps_print (m_glfcns, fig, file_cmd.toStdString (), term.toStdString ()); @@ -174,7 +174,7 @@ { begin_rendering (); - unwind_action reset_current ([=] () { end_rendering (); }); + unwind_action reset_current ([this] () { end_rendering (); }); octave::opengl_selector s (m_glfcns); @@ -201,7 +201,7 @@ begin_rendering (); - unwind_action reset_current ([=] () { end_rendering (); }); + unwind_action reset_current ([this] () { end_rendering (); }); m_renderer.draw_zoom_box (width (), height (), p1.x (), p1.y (), p2.x (), p2.y (), @@ -348,7 +348,7 @@ catch (octave::execution_exception& ee) { emit interpreter_event - ([=] () + ([ee] () { // INTERPRETER THREAD throw ee; diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/qterminal/libqterminal/QTerminal.cc --- a/libgui/qterminal/libqterminal/QTerminal.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/qterminal/libqterminal/QTerminal.cc Fri Feb 16 14:42:54 2024 -0500 @@ -195,7 +195,7 @@ std::string expr = m_doc_selected_action->data ().toString ().toStdString (); emit interpreter_event - ([=] (octave::interpreter& interp) + ([expr] (octave::interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/command-widget.cc --- a/libgui/src/command-widget.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/command-widget.cc Fri Feb 16 14:42:54 2024 -0500 @@ -110,7 +110,7 @@ QPointer this_cw (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_cw] (interpreter& interp) { // INTERPRETER THREAD @@ -158,7 +158,7 @@ QPointer this_cw (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_cw, input_line] (interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/documentation.cc --- a/libgui/src/documentation.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/documentation.cc Fri Feb 16 14:42:54 2024 -0500 @@ -184,7 +184,7 @@ QLabel *find_label = new QLabel (tr ("Find:"), find_footer); m_find_line_edit = new QLineEdit (find_footer); connect (m_find_line_edit, &QLineEdit::returnPressed, - this, [=] () { find (); }); + this, [this] () { find (); }); connect (m_find_line_edit, &QLineEdit::textEdited, this, &documentation::find_forward_from_anchor); QToolButton *forward_button = new QToolButton (find_footer); @@ -195,7 +195,7 @@ forward_button->setIcon (settings.icon ("go-down")); connect (forward_button, &QToolButton::pressed, - this, [=] () { find (); }); + this, [this] () { find (); }); QToolButton *backward_button = new QToolButton (find_footer); backward_button->setText (tr ("Search backward")); backward_button->setToolTip (tr ("Search backward")); @@ -220,7 +220,7 @@ m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut); connect (m_findnext_shortcut, &QShortcut::activated, - this, [=] () { find (); }); + this, [this] () { find (); }); m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut); connect (m_findprev_shortcut, &QShortcut::activated, this, &documentation::find_backward); @@ -246,8 +246,7 @@ connect (m_help_engine->contentWidget (), &QHelpContentWidget::linkActivated, - m_doc_browser, [=] (const QUrl& url) { - m_doc_browser->handle_index_clicked (url); }); + m_doc_browser, [this] (const QUrl& url) { m_doc_browser->handle_index_clicked (url); }); // Index QHelpIndexWidget *index = m_help_engine->indexWidget (); @@ -283,8 +282,7 @@ #if defined (HAVE_NEW_QHELPINDEXWIDGET_API) connect (m_help_engine->indexWidget (), &QHelpIndexWidget::documentActivated, - this, [=] (const QHelpLink &link) { - m_doc_browser->handle_index_clicked (link.url); }); + this, [this] (const QHelpLink &link) { m_doc_browser->handle_index_clicked (link.url); }); #else connect (m_help_engine->indexWidget (), &QHelpIndexWidget::linkActivated, @@ -302,7 +300,7 @@ navi->addTab (m_bookmarks, tr ("Bookmarks")); connect (m_action_bookmark, &QAction::triggered, - m_bookmarks, [=] () { m_bookmarks->add_bookmark (); }); + m_bookmarks, [this] () { m_bookmarks->add_bookmark (); }); // Search QHelpSearchEngine *search_engine = m_help_engine->searchEngine (); @@ -1060,7 +1058,7 @@ { setOpenLinks (false); connect (this, &documentation_browser::anchorClicked, - this, [=] (const QUrl& url) { handle_index_clicked (url); }); + this, [this] (const QUrl& url) { handle_index_clicked (url); }); // Make sure we have access to one of the monospace fonts listed in // octave.css for rendering formated code blocks diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/files-dock-widget.cc Fri Feb 16 14:42:54 2024 -0500 @@ -171,9 +171,7 @@ // actually restrict the selection, we have to post the modification at // the end of the event loop. // QTimer allows this easily with 0 as timeout. - QTimer::singleShot (0, [=] () { - line_edit->setSelection (0, select_len); - }); + QTimer::singleShot (0, [line_edit, select_len] () { line_edit->setSelection (0, select_len); }); } }; @@ -677,7 +675,7 @@ QMenu *add_path_menu = menu.addMenu (tr ("Add to Path")); add_path_menu->addAction (tr ("Selected Directories"), - this, [=] (bool checked) { contextmenu_add_to_path (checked); }); + this, [this] (bool checked) { contextmenu_add_to_path (checked); }); add_path_menu->addAction (tr ("Selected Directories and Subdirectories"), this, &files_dock_widget::contextmenu_add_to_path_subdirs); diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/interpreter-qobject.cc --- a/libgui/src/interpreter-qobject.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/interpreter-qobject.cc Fri Feb 16 14:42:54 2024 -0500 @@ -191,7 +191,7 @@ // interpreter is paused. interpreter_event - ([=] (interpreter& interp) + ([] (interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Feb 16 14:42:54 2024 -0500 @@ -246,7 +246,7 @@ this, SLOT (handle_copy_available (bool))); connect (&m_file_system_watcher, &QFileSystemWatcher::fileChanged, - this, [=] (const QString& path) { file_has_changed (path); }); + this, [this] (const QString& path) { file_has_changed (path); }); connect (this, &file_editor_tab::maybe_remove_next, this, &file_editor_tab::handle_remove_next); @@ -448,7 +448,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab, line, new_cond] (interpreter& interp) { // INTERPRETER THREAD @@ -853,7 +853,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab, octave_builtins, octave_functions] (interpreter& interp) { // INTERPRETER THREAD @@ -1240,7 +1240,7 @@ file_editor_tab::handle_request_remove_breakpoint (int line) { emit interpreter_event - ([=] (interpreter& interp) + ([this, line] (interpreter& interp) { // INTERPRETER THREAD @@ -1322,7 +1322,7 @@ return; emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER THREAD @@ -1442,7 +1442,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab, line, cond] (interpreter& interp) { // INTERPRETER THREAD @@ -2017,7 +2017,7 @@ msg_box->show (); } - unwind_action free_u16_str ([=] () { ::free (u16_str); }); + unwind_action free_u16_str ([u16_str] () { ::free (u16_str); }); QString text = QString::fromUtf16 (reinterpret_cast (u16_str), length); @@ -2173,7 +2173,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab] (interpreter& interp) { // INTERPRETER THREAD @@ -2251,7 +2251,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab, base_name, file_to_save, remove_on_success, restore_breakpoints] (interpreter& interp) { // INTERPRETER THREAD @@ -2320,7 +2320,7 @@ QPointer this_fetab (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fetab, base_name, file_to_save, remove_on_success, restore_breakpoints] (interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/m-editor/file-editor.cc Fri Feb 16 14:42:54 2024 -0500 @@ -723,7 +723,7 @@ QPointer this_fe (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_fe] (interpreter& interp) { // INTERPRETER THREAD @@ -2614,7 +2614,7 @@ this, &file_editor::handle_mru_add_file); connect (f, &file_editor_tab::request_open_file, - this, [=] (const QString& fname, const QString& encoding) { request_open_file (fname, encoding); }); + this, [this] (const QString& fname, const QString& encoding) { request_open_file (fname, encoding); }); connect (f, &file_editor_tab::edit_area_changed, this, &file_editor::edit_area_changed); @@ -2624,7 +2624,7 @@ // Signals from the file_editor or main-win non-trivial operations connect (this, &file_editor::fetab_settings_changed, - f, [=] () { f->notice_settings (); }); + f, [f] () { f->notice_settings (); }); connect (this, &file_editor::fetab_change_request, f, &file_editor_tab::change_editor_state); diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.cc Fri Feb 16 14:42:54 2024 -0500 @@ -344,7 +344,7 @@ std::string name = m_word_at_cursor.toStdString (); emit interpreter_event - ([=] (interpreter& interp) + ([name] (interpreter& interp) { // INTERPRETER THREAD @@ -938,7 +938,7 @@ // Add commands to the history emit interpreter_event - ([=] (interpreter& interp) + ([tmp_hist] (interpreter& interp) { // INTERPRETER THREAD @@ -965,7 +965,7 @@ // Let the interpreter execute the tmp file emit interpreter_event - ([=] (interpreter& interp) + ([this, this_oq, tmp_file, tmp_hist, show_dbg_file] (interpreter& interp) { // INTERPRETER THREAD @@ -1103,7 +1103,7 @@ tmp_hist->remove (); emit interpreter_event - ([=] (interpreter& interp) + ([dbg, auto_repeat] (interpreter& interp) { // INTERPRETER THREAD if (dbg) diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/main-window.cc Fri Feb 16 14:42:54 2024 -0500 @@ -675,7 +675,7 @@ if (! file.isEmpty ()) { emit interpreter_event - ([=] (interpreter& interp) + ([file] (interpreter& interp) { // INTERPRETER THREAD @@ -704,7 +704,7 @@ if (! file.isEmpty ()) { emit interpreter_event - ([=] (interpreter& interp) + ([file] (interpreter& interp) { // INTERPRETER THREAD @@ -727,7 +727,7 @@ std::string file = file_arg.toStdString (); emit interpreter_event - ([=] (interpreter& interp) + ([file] (interpreter& interp) { // INTERPRETER THREAD @@ -806,7 +806,7 @@ bool rm, bool subdirs) { emit interpreter_event - ([=] (interpreter& interp) + ([dir_list, subdirs, rm] (interpreter& interp) { // INTERPRETER THREAD @@ -1129,7 +1129,7 @@ if (fileInfo.exists () && fileInfo.isDir ()) { emit interpreter_event - ([=] (interpreter& interp) + ([xdir] (interpreter& interp) { // INTERPRETER THREAD @@ -1173,7 +1173,7 @@ else { emit interpreter_event - ([=] () + ([command] () { // INTERPRETER THREAD @@ -1194,7 +1194,7 @@ main_window::run_file_in_terminal (const QFileInfo& info) { emit interpreter_event - ([=] (interpreter& interp) + ([info] (interpreter& interp) { // INTERPRETER THREAD @@ -1276,7 +1276,7 @@ main_window::debug_continue () { emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER THREAD @@ -1291,7 +1291,7 @@ main_window::debug_step_into () { emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER THREAD @@ -1310,7 +1310,7 @@ // We are in debug mode, just call dbstep. emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER THREAD @@ -1332,7 +1332,7 @@ main_window::debug_step_out () { emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER THREAD @@ -1455,7 +1455,7 @@ QPointer this_mw (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_mw, fname, ffile, curr_dir, line] (interpreter& interp) { // INTERPRETER THREAD @@ -1855,7 +1855,7 @@ QPointer this_mw (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_mw] (interpreter& interp) { // INTERPRETER_THREAD @@ -1951,7 +1951,7 @@ main_window::set_screen_size (int ht, int wd) { emit interpreter_event - ([=] () + ([ht, wd] () { // INTERPRETER THREAD @@ -2024,7 +2024,7 @@ main_window::profiler_session () { emit interpreter_event - ([=] (interpreter& interp) + ([] (interpreter& interp) { // INTERPRETER THREAD F__profiler_enable__ (interp, ovl (true)); @@ -2035,7 +2035,7 @@ main_window::profiler_session_resume () { emit interpreter_event - ([=] (interpreter& interp) + ([] (interpreter& interp) { // INTERPRETER THREAD F__profiler_enable__ (interp, ovl (true)); @@ -2046,7 +2046,7 @@ main_window::profiler_stop () { emit interpreter_event - ([=] (interpreter& interp) + ([] (interpreter& interp) { // INTERPRETER THREAD F__profiler_enable__ (interp, ovl (false)); @@ -2150,7 +2150,7 @@ // Default argument requires wrapper. connect (this, &main_window::settings_changed, - this, [=] () { notice_settings (); }); + this, [this] () { notice_settings (); }); // Connections for signals from the interpreter thread where the slot // should be executed by the gui thread @@ -2201,7 +2201,7 @@ this, &main_window::handle_exit_debugger); connect (qt_link, &qt_interpreter_events::show_preferences_signal, - this, [=] () { process_settings_dialog_request (); }); + this, [this] () { process_settings_dialog_request (); }); connect (qt_link, &qt_interpreter_events::insert_debugger_pointer_signal, this, &main_window::handle_insert_debugger_pointer_request); @@ -2419,7 +2419,7 @@ tr ("Preferences...")); connect (m_find_files_action, &QAction::triggered, - this, [=] () { find_files (); }); + this, [this] () { find_files (); }); connect (m_clear_command_window_action, &QAction::triggered, this, &main_window::handle_clear_command_window_request); @@ -2442,7 +2442,7 @@ #endif connect (m_preferences_action, &QAction::triggered, - this, [=] () { process_settings_dialog_request (); }); + this, [this] () { process_settings_dialog_request (); }); connect (m_set_path_action, &QAction::triggered, this, &main_window::handle_set_path_dialog_request); @@ -2672,17 +2672,13 @@ m_release_notes_action = news_menu->addAction (QIcon (), tr ("Release Notes"), - [=] () { - emit show_release_notes_signal (); - }); + [this] () { emit show_release_notes_signal (); }); addAction (m_release_notes_action); m_release_notes_action->setShortcutContext (Qt::ApplicationShortcut); m_current_news_action = news_menu->addAction (QIcon (), tr ("Community News"), - [=] () { - emit show_community_news_signal (-1); - }); + [this] () { emit show_community_news_signal (-1); }); addAction (m_current_news_action); m_current_news_action->setShortcutContext (Qt::ApplicationShortcut); } @@ -2863,7 +2859,7 @@ mfile_encoding = "SYSTEM"; emit interpreter_event - ([=] (interpreter& interp) + ([mfile_encoding] (interpreter& interp) { // INTERPRETER THREAD @@ -2910,7 +2906,7 @@ // connections so that the event loop can do what it needs to do. // But I haven't been able to find the magic sequence. - QTimer::singleShot (250, this, [=] () { do_reset_windows (true, true, true); }); + QTimer::singleShot (250, this, [this] () { do_reset_windows (true, true, true); }); } // Create the default layout of the main window. Do not use diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/octave-dock-widget.cc --- a/libgui/src/octave-dock-widget.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/octave-dock-widget.cc Fri Feb 16 14:42:54 2024 -0500 @@ -215,7 +215,7 @@ connect (this, &octave_dock_widget::queue_make_window, this, &octave_dock_widget::make_window, Qt::QueuedConnection); connect (this, &octave_dock_widget::queue_make_widget, - this, [=] () { make_widget (); }, Qt::QueuedConnection); + this, [this] () { make_widget (); }, Qt::QueuedConnection); gui_settings settings; diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/octave-qobject.cc --- a/libgui/src/octave-qobject.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/octave-qobject.cc Fri Feb 16 14:42:54 2024 -0500 @@ -152,7 +152,7 @@ catch (execution_exception& ee) { emit interpreter_event - ([=] () + ([ee] () { // INTERPRETER THREAD throw ee; @@ -584,7 +584,7 @@ m_history_widget, &history_dock_widget::clear_history); emit interpreter_event - ([=] (interpreter& interp) { + ([] (interpreter& interp) { // INTERPRETER THREAD event_manager& xevmgr = interp.get_event_manager (); @@ -622,9 +622,9 @@ connect (m_workspace_widget, &workspace_view::copy_variable_value_to_clipboard, - [=] (const QString& var_name) { + [this] (const QString& var_name) { emit interpreter_event - ([=] (interpreter& interp) + ([var_name] (interpreter& interp) { // INTERPRETER THREAD @@ -645,9 +645,9 @@ }); connect (m_workspace_widget, &workspace_view::rename_variable_signal, - [=] (const QString& old_name, const QString& new_name) { + [this] (const QString& old_name, const QString& new_name) { emit interpreter_event - ([=] (interpreter& interp) { + ([old_name, new_name] (interpreter& interp) { // INTERPRETER THREAD symbol_scope scope = interp.get_current_scope (); @@ -670,9 +670,9 @@ }); connect (m_workspace_widget, &workspace_view::edit_variable_signal, - [=] (const QString& var_name) { + [this] (const QString& var_name) { emit interpreter_event - ([=] (interpreter& interp) { + ([var_name] (interpreter& interp) { // INTERPRETER THREAD std::string name = var_name.toStdString (); @@ -685,7 +685,7 @@ }); emit interpreter_event - ([=] (interpreter& interp) { + ([] (interpreter& interp) { // INTERPRETER THREAD event_manager& xevmgr = interp.get_event_manager (); @@ -936,7 +936,7 @@ base_qobject::execute_command (const QString& command) { emit interpreter_event - ([=] (interpreter& interp) + ([command] (interpreter& interp) { // INTERPRETER THREAD @@ -963,7 +963,7 @@ // returning to the command line? interpreter_event - ([=] (interpreter& interp) + ([] (interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/set-path-model.cc --- a/libgui/src/set-path-model.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/set-path-model.cc Fri Feb 16 14:42:54 2024 -0500 @@ -80,7 +80,7 @@ std::string path_str = to_string (); emit interpreter_event - ([=] (interpreter& interp) + ([path_str] (interpreter& interp) { // INTERPRETER THREAD @@ -305,7 +305,7 @@ QPointer this_spm (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_spm] (interpreter& interp) { // INTERPRETER THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/settings-dialog.cc Fri Feb 16 14:42:54 2024 -0500 @@ -579,7 +579,7 @@ connect (cb_color_mode, &QCheckBox::stateChanged, this, &settings_dialog::update_editor_lexers); connect (pb_reload_default_colors, &QPushButton::clicked, - [=] () { update_editor_lexers (settings_reload_default_colors_flag); }); + [this] () { update_editor_lexers (settings_reload_default_colors_flag); }); // finally read the lexer colors using the update slot update_editor_lexers (); @@ -1489,7 +1489,7 @@ connect (cb_color_mode, &QCheckBox::stateChanged, this, &settings_dialog::update_workspace_colors); connect (pb_reload_default_colors, &QPushButton::clicked, - [=] () { update_workspace_colors (settings_reload_default_colors_flag); }); + [this] () { update_workspace_colors (settings_reload_default_colors_flag); }); } void @@ -1604,7 +1604,7 @@ connect (cb_color_mode, &QCheckBox::stateChanged, this, &settings_dialog::update_terminal_colors); connect (pb_reload_default_colors, &QPushButton::clicked, - [=] () { update_terminal_colors (settings_reload_default_colors_flag); }); + [this] () { update_terminal_colors (settings_reload_default_colors_flag); }); } void @@ -1717,7 +1717,7 @@ connect (cb_color_mode, &QCheckBox::stateChanged, this, &settings_dialog::update_varedit_colors); connect (pb_reload_default_colors, &QPushButton::clicked, - [=] () { update_varedit_colors (settings_reload_default_colors_flag); }); + [this] () { update_varedit_colors (settings_reload_default_colors_flag); }); } void diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/variable-editor-model.cc --- a/libgui/src/variable-editor-model.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/variable-editor-model.cc Fri Feb 16 14:42:54 2024 -0500 @@ -1008,7 +1008,7 @@ QPointer this_vem (this); emit interpreter_event - ([=] (interpreter& interp) + ([this, this_vem, expr, nm, idx] (interpreter& interp) { // INTERPRETER THREAD @@ -1163,7 +1163,7 @@ std::string expr = expr_arg.toStdString (); emit interpreter_event - ([=] (interpreter& interp) + ([this, expr] (interpreter& interp) { // INTERPRETER THREAD @@ -1235,7 +1235,7 @@ variable_editor_model::update_data_cache () { emit interpreter_event - ([=] (interpreter& interp) + ([this] (interpreter& interp) { // INTERPRETER_THREAD diff -r 7de59b26cf79 -r 49128bdb9eb2 libgui/src/variable-editor.cc --- a/libgui/src/variable-editor.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libgui/src/variable-editor.cc Fri Feb 16 14:42:54 2024 -0500 @@ -465,7 +465,7 @@ // No format given, test save default options emit interpreter_event - ([=] (interpreter& interp) + ([this, this_ves, format_string] (interpreter& interp) { // INTERPRETER THREAD @@ -520,7 +520,7 @@ // Let the interpreter thread do the saving emit interpreter_event - ([=] (interpreter& interp) + ([file, name, format] (interpreter& interp) { // INTERPRETER THREAD @@ -1308,7 +1308,7 @@ connect (this, &variable_editor::level_up_signal, stack, &variable_editor_stack::levelUp); connect (this, &variable_editor::save_signal, - stack, [=] () { stack->save (); }); + stack, [stack] () { stack->save (); }); variable_editor_view *edit_view = stack->edit_view (); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/call-stack.cc --- a/libinterp/corefcn/call-stack.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/call-stack.cc Fri Feb 16 14:42:54 2024 -0500 @@ -1054,7 +1054,7 @@ push (tmp_scope); - unwind_action restore_scope ([=] () { pop (); }); + unwind_action restore_scope ([this] () { pop (); }); interpreter& interp = m_evaluator.get_interpreter (); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/gl2ps-print.cc --- a/libinterp/corefcn/gl2ps-print.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/gl2ps-print.cc Fri Feb 16 14:42:54 2024 -0500 @@ -404,7 +404,7 @@ if (! tmpf) error ("gl2ps_renderer::draw: couldn't open temporary file for printing"); - frame.add ([=] () { std::fclose (tmpf); }); + frame.add ([tmpf] () { std::fclose (tmpf); }); // Reset buffsize, unless this is 2nd pass of a texstandalone print. if (m_term.find ("tex") == std::string::npos) @@ -1621,7 +1621,7 @@ error (R"(print: failed to open pipe "%s")", stream.c_str ()); // Need octave:: qualifier here to avoid ambiguity. - frame.add ([=] () { octave::pclose (m_fp); }); + frame.add ([m_fp] () { octave::pclose (m_fp); }); } else { @@ -1632,7 +1632,7 @@ if (! m_fp) error (R"(gl2ps_print: failed to create file "%s")", stream.c_str ()); - frame.add ([=] () { std::fclose (m_fp); }); + frame.add ([m_fp] () { std::fclose (m_fp); }); } gl2ps_renderer rend (glfcns, m_fp, term); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/graphics.cc Fri Feb 16 14:42:54 2024 -0500 @@ -2190,7 +2190,7 @@ // their handlevisibility property set to "callback" to be visible. octave::unwind_action executing_callbacks_cleanup - ([=] () { executing_callbacks.erase (this); }); + ([this] () { executing_callbacks.erase (this); }); if (! executing_callbacks.contains (this)) { diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/input.cc --- a/libinterp/corefcn/input.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/input.cc Fri Feb 16 14:42:54 2024 -0500 @@ -1107,7 +1107,7 @@ "converting from codepage '%s' to UTF-8: %s", encoding.c_str (), std::strerror (errno)); - unwind_action free_utf8_str ([=] () { ::free (utf8_str); }); + unwind_action free_utf8_str ([utf8_str] () { ::free (utf8_str); }); src_str = std::string (reinterpret_cast (utf8_str), length); } diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/interpreter.cc Fri Feb 16 14:42:54 2024 -0500 @@ -705,8 +705,7 @@ unwind_action restore_add_hook (&load_path::set_add_hook, &m_load_path, m_load_path.get_add_hook ()); - m_load_path.set_add_hook ([=] (const std::string& dir) - { this->execute_pkg_add (dir); }); + m_load_path.set_add_hook ([this] (const std::string& dir) { this->execute_pkg_add (dir); }); m_load_path.initialize (set_initial_path); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/load-path.cc --- a/libinterp/corefcn/load-path.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/load-path.cc Fri Feb 16 14:42:54 2024 -0500 @@ -245,8 +245,8 @@ load_path::abs_dir_cache_type load_path::s_abs_dir_cache; load_path::load_path (interpreter& interp) - : m_add_hook ([=] (const std::string& dir) { this->execute_pkg_add (dir); }), -m_remove_hook ([=] (const std::string& dir) { this->execute_pkg_del (dir); }), + : m_add_hook ([this] (const std::string& dir) { this->execute_pkg_add (dir); }), +m_remove_hook ([this] (const std::string& dir) { this->execute_pkg_del (dir); }), m_interpreter (interp), m_package_map (), m_top_level_package (), m_dir_info_list (), m_init_dirs (), m_command_line_path () { } diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/mex.cc Fri Feb 16 14:42:54 2024 -0500 @@ -1940,7 +1940,7 @@ if (current_mx_memory_resource == &the_mx_deleting_memory_resource) { - octave::unwind_action act ([=] () { maybe_disown_ptr (m_pr); }); + octave::unwind_action act ([this] () { maybe_disown_ptr (m_pr); }); return octave_value (Array (ppr, dv, current_mx_memory_resource)); } @@ -2392,7 +2392,7 @@ if (current_mx_memory_resource == &the_mx_deleting_memory_resource) { - octave::unwind_action act ([=] () + octave::unwind_action act ([this] () { maybe_disown_ptr (m_pr); maybe_disown_ptr (m_ir); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/pr-output.cc Fri Feb 16 14:42:54 2024 -0500 @@ -3605,7 +3605,7 @@ frame.protect_var (Vcompact_format); frame.protect_var (uppercase_format); int prec = output_precision (); - frame.add ([=] () { set_output_prec (prec); }); + frame.add ([prec] () { set_output_prec (prec); }); format = format_string; // Initialize with existing value while (argc-- > 0) diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/strfns.cc --- a/libinterp/corefcn/strfns.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/strfns.cc Fri Feb 16 14:42:54 2024 -0500 @@ -908,7 +908,7 @@ codepage, std::strerror (errno)); } - unwind_action free_utf8_str ([=] () { ::free (utf8_str); }); + unwind_action free_utf8_str ([utf8_str] () { ::free (utf8_str); }); octave_idx_type len = length; @@ -953,7 +953,7 @@ codepage, std::strerror (errno)); } - unwind_action free_native_bytes ([=] () { ::free (native_bytes); }); + unwind_action free_native_bytes ([native_bytes] () { ::free (native_bytes); }); octave_idx_type len = length; diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/corefcn/sysdep.cc --- a/libinterp/corefcn/sysdep.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/corefcn/sysdep.cc Fri Feb 16 14:42:54 2024 -0500 @@ -907,7 +907,7 @@ if (result != ERROR_SUCCESS) return result; - unwind_action restore_keys ([=] () { reg_close_key_wrapper (h_subkey); }); + unwind_action restore_keys ([] () { reg_close_key_wrapper (h_subkey); }); std::wstring wname = sys::u8_to_wstring (name); DWORD length = 0; diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/dldfcn/__delaunayn__.cc --- a/libinterp/dldfcn/__delaunayn__.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/dldfcn/__delaunayn__.cc Fri Feb 16 14:42:54 2024 -0500 @@ -174,7 +174,7 @@ if (! errfile) error ("__delaunayn__: unable to redirect Qhull errors to /dev/null"); - unwind_action close_errfile ([=] () { std::fclose (errfile); }); + unwind_action close_errfile ([errfile] () { std::fclose (errfile); }); qhT context = { }; qhT *qh = &context; diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/dldfcn/audiodevinfo.cc --- a/libinterp/dldfcn/audiodevinfo.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/dldfcn/audiodevinfo.cc Fri Feb 16 14:42:54 2024 -0500 @@ -1136,7 +1136,7 @@ start = get_sample_number (); end = get_end_sample (); - unwind_action stop_audioplayer ([=] () { stop (); }); + unwind_action stop_audioplayer ([this] () { stop (); }); for (unsigned int i = start; i < end; i += buffer_size) { @@ -1816,7 +1816,7 @@ unsigned int frames = seconds * get_fs (); - unwind_action stop_audiorecorder ([=] () { stop (); }); + unwind_action stop_audiorecorder ([this] () { stop (); }); for (unsigned int i = 0; i < frames; i += buffer_size) { diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/dldfcn/audioread.cc --- a/libinterp/dldfcn/audioread.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/dldfcn/audioread.cc Fri Feb 16 14:42:54 2024 -0500 @@ -90,7 +90,7 @@ error ("audioread: failed to open input file '%s': %s", filename.c_str (), sf_strerror (file)); - unwind_action close_open_file ([=] () { sf_close (file); }); + unwind_action close_open_file ([file] () { sf_close (file); }); // FIXME: It would be nicer to use a C++ expandable data container and // read a file of unknown length into memory in chunks and determine the @@ -441,7 +441,7 @@ error ("audiowrite: failed to open output file '%s': %s", filename.c_str (), sf_strerror (file)); - unwind_action close_open_file ([=] () { sf_close (file); }); + unwind_action close_open_file ([file] () { sf_close (file); }); sf_command (file, SFC_SET_NORM_DOUBLE, nullptr, SF_TRUE); sf_command (file, SFC_SET_CLIPPING, nullptr, SF_TRUE) ; @@ -644,7 +644,7 @@ error ("audioinfo: failed to open input file '%s': %s", filename.c_str (), sf_strerror (file)); - unwind_action close_open_file ([=] () { sf_close (file); }); + unwind_action close_open_file ([file] () { sf_close (file); }); octave_scalar_map result; diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/parse-tree/oct-parse.yy Fri Feb 16 14:42:54 2024 -0500 @@ -5827,7 +5827,7 @@ return octave_value (); } - unwind_action act ([=] () { ::fclose (ffile); }); + unwind_action act ([ffile] () { ::fclose (ffile); }); // get the encoding for this folder input_system& input_sys = interp.get_input_system (); @@ -6659,7 +6659,7 @@ // the eval, then the message is stored in the exception object and we // will display it later, after the buffers have been restored. - unwind_action act ([=] () + unwind_action act ([old_out_buf, old_err_buf] () { octave_stdout.rdbuf (old_out_buf); std::cerr.rdbuf (old_err_buf); diff -r 7de59b26cf79 -r 49128bdb9eb2 libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/libinterp/parse-tree/pt-eval.cc Fri Feb 16 14:42:54 2024 -0500 @@ -675,7 +675,7 @@ exiting = false; evmgr.post_event - ([&] (interpreter& interp) + ([this, input, &mtx, &incomplete_parse, &evaluation_pending, &cv, &exiting] (interpreter& interp) { // INTERPRETER THREAD @@ -694,14 +694,14 @@ } catch (const execution_exception& ee) { - error_system& es = m_interpreter.get_error_system (); + error_system& es = interp.get_error_system (); es.save_exception (ee); es.display_exception (ee); - if (m_interpreter.interactive ()) + if (interp.interactive ()) { - m_interpreter.recover_from_exception (); + interp.recover_from_exception (); m_parser->reset (); evaluation_pending = false; cv.notify_all (); @@ -727,7 +727,7 @@ // Wait until evaluation is finished before prompting for input // again. - cv.wait (lock, [&] { return ! evaluation_pending; }); + cv.wait (lock, [&evaluation_pending] { return ! evaluation_pending; }); if (exiting) break; @@ -1177,7 +1177,7 @@ const std::string& try_code, int nargout) { - unwind_action act ([=] (std::size_t frm) + unwind_action act ([this] (std::size_t frm) { m_call_stack.restore_frame (frm); }, m_call_stack.current_frame ()); @@ -1202,7 +1202,7 @@ { octave_value_list retval; - unwind_action act1 ([=] (std::size_t frm) + unwind_action act1 ([this] (std::size_t frm) { m_call_stack.restore_frame (frm); }, m_call_stack.current_frame ()); @@ -1429,7 +1429,7 @@ m_debugger_stack.push (dbgr); - frame.add ([=] () + frame.add ([this] () { delete m_debugger_stack.top (); m_debugger_stack.pop (); @@ -2017,7 +2017,7 @@ // by getting a reference to the caller or base stack frame and // calling assign on that? - unwind_action act ([=] (std::size_t frm) + unwind_action act ([this] (std::size_t frm) { m_call_stack.restore_frame (frm); }, m_call_stack.current_frame ()); @@ -5134,7 +5134,7 @@ // evaluate the partial expression that the special "end" // token applies to in the calling stack frame. - unwind_action act ([=] (std::size_t frm) + unwind_action act ([this] (std::size_t frm) { m_call_stack.restore_frame (frm); }, m_call_stack.current_frame ()); diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/array/Array-util.cc --- a/liboctave/array/Array-util.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/array/Array-util.cc Fri Feb 16 14:42:54 2024 -0500 @@ -577,13 +577,7 @@ octave_idx_type *idx_vec = idx.rwdata (); if (i < len - 1) - { - octave_idx_type n = dvx(i); - - idxa(i).loop (clen, [=, &idx_vec] (octave_idx_type k) { - (*idx_vec++ *= n) += k; - }); - } + idxa(i).loop (clen, [n = dvx(i), &idx_vec] (octave_idx_type k) { (*idx_vec++ *= n) += k; }); else idxa(i).copy_data (idx_vec); } diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/array/Range.h --- a/liboctave/array/Range.h Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/array/Range.h Fri Feb 16 14:42:54 2024 -0500 @@ -251,7 +251,7 @@ T *array = retval.rwdata (); - idx.loop (n, [=, &array] (octave_idx_type i) + idx.loop (n, [this, &array] (octave_idx_type i) { if (i == 0) // Required for proper NaN handling. diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/system/lo-sysdep.cc Fri Feb 16 14:42:54 2024 -0500 @@ -239,7 +239,7 @@ return false; } - unwind_action act ([=] () + unwind_action act ([] () { std::fclose (fptr); sys::unlink (tmpname); diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/util/lo-regexp.cc --- a/liboctave/util/lo-regexp.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/util/lo-regexp.cc Fri Feb 16 14:42:54 2024 -0500 @@ -368,16 +368,15 @@ octave_quit (); #if defined (HAVE_PCRE2) - pcre2_match_data *m_data + pcre2_match_data *tmp_match_data = pcre2_match_data_create_from_pattern (re, nullptr); - unwind_action cleanup_match_data - ([=] () { pcre2_match_data_free (m_data); }); + unwind_action cleanup_match_data ([tmp_match_data] () { pcre2_match_data_free (tmp_match_data); }); int matches = pcre2_match (re, reinterpret_cast (buffer.c_str ()), buffer.length (), idx, PCRE2_NO_UTF_CHECK | (idx ? PCRE2_NOTBOL : 0), - m_data, nullptr); + tmp_match_data, nullptr); if (matches < 0 && matches != PCRE2_ERROR_NOMATCH) (*current_liboctave_error_handler) @@ -387,7 +386,7 @@ if (matches == PCRE2_ERROR_NOMATCH) break; - OCTAVE_PCRE_SIZE *ovector = pcre2_get_ovector_pointer (m_data); + OCTAVE_PCRE_SIZE *ovector = pcre2_get_ovector_pointer (tmp_match_data); #else int matches = pcre_exec (re, nullptr, buffer.c_str (), buffer.length (), idx, diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/util/oct-glob.cc --- a/liboctave/util/oct-glob.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/util/oct-glob.cc Fri Feb 16 14:42:54 2024 -0500 @@ -81,7 +81,7 @@ void *glob_info = octave_create_glob_info_struct (); unwind_action cleanup_glob_info_struct - ([=] () { octave_destroy_glob_info_struct (glob_info); }); + ([glob_info] () { octave_destroy_glob_info_struct (glob_info); }); for (int i = 0; i < npat; i++) { @@ -184,7 +184,7 @@ if (h_find == INVALID_HANDLE_VALUE) return; - unwind_action close_h_find ([=] () { FindClose (h_find); }); + unwind_action close_h_find ([] () { FindClose (h_find); }); // find all files that match pattern do @@ -311,8 +311,7 @@ void *glob_info = octave_create_glob_info_struct (); - unwind_action cleanup_glob_info_struct - ([=] () { octave_destroy_glob_info_struct (glob_info); }); + unwind_action cleanup_glob_info_struct ([glob_info] () { octave_destroy_glob_info_struct (glob_info); }); for (int i = 0; i < npat; i++) { diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/util/oct-string.cc --- a/liboctave/util/oct-string.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/util/oct-string.cc Fri Feb 16 14:42:54 2024 -0500 @@ -521,7 +521,7 @@ who.c_str (), encoding.c_str (), std::strerror (errno)); } - octave::unwind_action free_native_str ([=] () { ::free (native_str); }); + octave::unwind_action free_native_str ([native_str] () { ::free (native_str); }); std::string retval = std::string (native_str, length); @@ -551,7 +551,7 @@ who.c_str (), encoding.c_str (), std::strerror (errno)); } - octave::unwind_action free_utf8_str ([=] () { ::free (utf8_str); }); + octave::unwind_action free_utf8_str ([utf8_str] () { ::free (utf8_str); }); std::string retval = std::string (reinterpret_cast (utf8_str), length); @@ -597,8 +597,7 @@ ("%s: converting from codepage '%s' to UTF-8 failed: %s", who.c_str (), fallback.c_str (), std::strerror (errno)); - octave::unwind_action free_val_utf8 - ([=] () { ::free (val_utf8); }); + octave::unwind_action free_val_utf8 ([val_utf8] () { ::free (val_utf8); }); out_str.append (reinterpret_cast (val_utf8), lengthp); @@ -635,7 +634,7 @@ who.c_str (), encoding.c_str (), std::strerror (errno)); } - octave::unwind_action free_native_str ([=] () { ::free (native_str); }); + octave::unwind_action free_native_str ([native_str] () { ::free (native_str); }); std::string retval = std::string (native_str, length); diff -r 7de59b26cf79 -r 49128bdb9eb2 liboctave/util/url-transfer.cc --- a/liboctave/util/url-transfer.cc Fri Feb 16 03:09:40 2024 -0500 +++ b/liboctave/util/url-transfer.cc Fri Feb 16 14:42:54 2024 -0500 @@ -425,7 +425,7 @@ { struct curl_slist *slist = nullptr; - unwind_action cleanup_slist ([=] () { curl_slist_free_all (slist); }); + unwind_action cleanup_slist ([slist] () { curl_slist_free_all (slist); }); std::string cmd = "rnfr " + oldname; slist = curl_slist_append (slist, cmd.c_str ()); @@ -597,7 +597,7 @@ struct curl_slist *slist = nullptr; - unwind_action cleanup_slist ([=] () { curl_slist_free_all (slist); }); + unwind_action cleanup_slist ([slist] () { curl_slist_free_all (slist); }); slist = curl_slist_append (slist, "pwd"); SETOPTR (CURLOPT_POSTQUOTE, slist); @@ -688,7 +688,7 @@ { struct curl_slist *slist = nullptr; - unwind_action cleanup_slist ([=] () { curl_slist_free_all (slist); }); + unwind_action cleanup_slist ([slist] () { curl_slist_free_all (slist); }); if (param.numel () >= 2) { @@ -715,7 +715,7 @@ SETOPT (CURLOPT_URL, m_host_or_url.c_str ()); - unwind_action cleanup_mime ([=] () { curl_mime_free (mime); }); + unwind_action cleanup_mime ([mime] () { curl_mime_free (mime); }); if (param.numel () >= 2) { @@ -890,7 +890,7 @@ { struct curl_slist *slist = nullptr; - unwind_action cleanup_slist ([=] () { curl_slist_free_all (slist); }); + unwind_action cleanup_slist ([slist] () { curl_slist_free_all (slist); }); std::string cmd = action + ' ' + file_or_dir;