[LyX/master] Fix C++20 warning on implicit capture of this via [=]

Yuriy Skalko yuriy.skalko at gmail.com
Tue Dec 29 14:33:39 UTC 2020


>> Hi Yuriy,
>> 
>> Apple clang spits this warning now - is it ok?
>> 
>> src/frontends/qt/GuiLyXFiles.cpp:200:16: warning: explicit capture of 'this' 
>> with a capture default of '=' is a C++2a extension [-Wc++2a-extensions]
>>                 filesLW, [=, this](){ focusAndHighlight(filesLW); });
> 
> 
> These now appear with gcc 8.3:
> 
>   CXX      GuiBibtex.o
> GuiBibtex.cpp: In constructor 
> 'lyx::frontend::GuiBibtex::GuiBibtex(lyx::frontend::GuiView&)':
> GuiBibtex.cpp:116:27: warning: explicit by-copy capture of 'this' redundant 
> with by-copy capture default
>           availableLV, [=, this](){ focusAndHighlight(availableLV); });
>                            ^~~~
> At global scope:
> cc1plus: warning: unrecognized command line option '-Wno-deprecated-copy'
>   CXX      GuiCitation.o
> GuiCitation.cpp: In constructor 
> 'lyx::frontend::GuiCitation::GuiCitation(lyx::frontend::GuiView&)':
> GuiCitation.cpp:160:27: warning: explicit by-copy capture of 'this' redundant 
> with by-copy capture default
>           availableLV, [=, this](){ focusAndHighlight(availableLV); });
>                            ^~~~
> At global scope:
> cc1plus: warning: unrecognized command line option '-Wno-deprecated-copy'
>   CXX      GuiDocument.o
> GuiDocument.cpp: In constructor 
> 'lyx::frontend::GuiDocument::GuiDocument(lyx::frontend::GuiView&)':
> GuiDocument.cpp:1676:35: warning: explicit by-copy capture of 'this' redundant 
> with by-copy capture default
>    modulesModule->availableLV, [=, this](){ 
> focusAndHighlight(modulesModule->availableLV); });
>                                    ^~~~
> At global scope:
> cc1plus: warning: unrecognized command line option '-Wno-deprecated-copy'
>   CXX      GuiLyXFiles.o
> GuiLyXFiles.cpp: In constructor 
> 'lyx::frontend::GuiLyXFiles::GuiLyXFiles(lyx::frontend::GuiView&)':
> GuiLyXFiles.cpp:200:16: warning: explicit by-copy capture of 'this' redundant 
> with by-copy capture default
>    filesLW, [=, this](){ focusAndHighlight(filesLW); });
>                 ^~~~
> At global scope:
> cc1plus: warning: unrecognized command line option '-Wno-deprecated-copy'
>   CXX      GuiRef.o
> GuiRef.cpp: In constructor 
> 'lyx::frontend::GuiRef::GuiRef(lyx::frontend::GuiView&)':
> GuiRef.cpp:70:22: warning: explicit by-copy capture of 'this' redundant with 
> by-copy capture default
>           refsTW, [=, this](){ focusAndHighlight(refsTW); });
>                       ^~~~
> 
> Pavel


Fixed. Now all compilers should be happy.

Yuriy


More information about the lyx-devel mailing list