[LyX/master] Do not return copies of string members
Enrico Forestieri
forenr at lyx.org
Thu May 11 17:59:48 UTC 2023
On Thu, May 11, 2023 at 04:32:45PM +0200, Jean-Marc Lasgouttes wrote:
>
>Le 11/05/2023 à 15:26, Jean-Marc Lasgouttes a écrit :
>>>In file included from ../../../../src/frontends/qt/Toolbars.cpp:15:
>>>../../../../src/Converter.h: In member function ‘const string&
>>>lyx::Converter::from() const’:
>>>../../../../src/Converter.h:55:51: warning: returning reference to
>>>temporary [-Wreturn-local-addr]
>>> 55 | std::string const & from() const { return from_; }
>>> | ^~~~~
>>
>>Does this warning make any sense to you? What do I miss? I get no
>>warning here.
>
>OK, I get it now this happens when using trivstring instead of plain
>std:string. I do not understand why this happens for you with gcc 11.
>
>I thought the new ABI wa savailable with gcc 5?
>
>Is this somthing special about cygwin or is our autoconf test broken?
The former, I think. This is what I get when comparing cygwin and native
windows configuration:
$ diff -up build-cygwin/config.h build-win32/config.h | grep -B1 STD_STRING
/* std::string uses copy-on-write */
-#define STD_STRING_USES_COW 1
+/* #undef STD_STRING_USES_COW */
So, cygwin is using COW in the std::string implementation...
--
Enrico
More information about the lyx-devel
mailing list