Le 22/11/2022 à 03:04, Pavel Sanda a écrit :
On Tue, Nov 22, 2022 at 01:47:26AM +0000, José Matos wrote:
On Mon, 2022-11-21 at 23:08 +0100, Pavel Sanda wrote:
Can you try whether the attached changes anything? P

It does, now those attached are what remains.

Nice, so now we know the culprit. The question is whether we want
to get rid of reference on the left side or fix the temps on the right.

We have to do something for this annoying warning. What about the following?

JMarc


From 71d372b787516a28e9ec726d4a390dcb83bff10c Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Wed, 8 Nov 2023 18:07:14 +0100
Subject: [PATCH] Avoid dangling-reference warning with theFontMetrics()

---
 src/frontends/FontMetrics.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/frontends/FontMetrics.h b/src/frontends/FontMetrics.h
index f3952706ae..1647552def 100644
--- a/src/frontends/FontMetrics.h
+++ b/src/frontends/FontMetrics.h
@@ -177,8 +177,18 @@ class Font;
 class FontInfo;
 
 /// Implementation is in Application.cpp
+
+/// Indicate to gcc that it is safe to pass a temporary variable to
+/// this function and return an address.
+#pragma GCC diagnostic push
+// the pragma below takes care of the case where -Wdangling-reference
+// is not implemented
+#pragma GCC diagnostic ignored "-Wpragmas"
+// disable locally the problematic warning
+#pragma GCC diagnostic ignored "-Wdangling-reference"
 frontend::FontMetrics const & theFontMetrics(Font const & f);
 frontend::FontMetrics const & theFontMetrics(FontInfo const & fi);
+#pragma GCC diagnostic pop
 
 } // namespace lyx
 
-- 
2.40.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to