[LyX/master] When a displayed inset is aligned left, align it left

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Mar 6 12:43:10 UTC 2023


Le 06/03/2023 à 12:02, José Matos a écrit :
> Previous disclaimer: What I am sending is not result of the change
> above but I it noticed because when updating the code
> src/TextMetrics.cpp had to compiled again.
> 
> There I saw this warning that follows attached:
> 
> warning: possibly dangling reference to a temporary

I have seen it already (is it gcc 13?), but I do not know where it comes 
from.

Could someone enlighten me about what is the temporary mentioned in the 
warning below?

/home/jamatos/lyx/lyx.anon/src/TextMetrics.cpp: In member function 
‘lyx::Row lyx::TextMetrics::tokenizeParagraph(lyx::pit_type) const’:
/home/jamatos/lyx/lyx.anon/src/TextMetrics.cpp:898:45: warning: possibly 
dangling reference to a temporary [-Wdangling-reference]
   898 |                         FontMetrics const & fm = 
theFontMetrics(text_->labelFont(par));
       |                                             ^~
/home/jamatos/lyx/lyx.anon/src/TextMetrics.cpp:898:64: note: the 
temporary was destroyed at the end of the full expression 
‘lyx::theFontMetrics(((lyx::Text*)((const 
lyx::TextMetrics*)this)->lyx::TextMetrics::text_)->lyx::Text::labelFont((* 
& par)))’
   898 |                         FontMetrics const & fm = 
theFontMetrics(text_->labelFont(par));
       | 
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

This blog entry is another example of false positive (very similar to 
our case actually):
https://trofi.github.io/posts/264-gcc-s-new-Wdangling-reference-warning.html

Seeing this gcc bug report, I think we just have to wait and see what 
happens.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107532

This warning is completely unreliable.

JMarc


More information about the lyx-devel mailing list