commit 94e7421a0a408bf60077bffe5d6f70142c5dad3f
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Wed Nov 16 17:43:22 2022 +0100

    Fix compilation with gcc 4.9
    
    It appears that gcc 4.9 does not implement the following part of C++11:
    https://cplusplus.github.io/CWG/issues/1148.html
    
    Therefore, we have to use a special case in C++11 mode that does an
    explicit std:move.
    
    With recent compilers (gcc >= 9), this leads in C++11 mode to a warning:
    
    MetricsInfo.cpp: In member function ‘lyx::Changer 
lyx::MetricsBase::changeFontSet(const string&)’:
    ../../master/src/MetricsInfo.cpp:83:13: warning: redundant move in return 
statement [-Wredundant-move]
       83 |  return move(rc);
          |         ~~~~^~~~
    MetricsInfo.cpp:83:13: note: remove ‘std::move’ call
    
    Partly reverts commit fff28c57.
---
 src/MetricsInfo.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp
index 92ed4a7..89196f3 100644
--- a/src/MetricsInfo.cpp
+++ b/src/MetricsInfo.cpp
@@ -75,7 +75,13 @@ Changer MetricsBase::changeFontSet(string const & name)
            && ((isTextFont(oldname) && oldcolor != Color_foreground)
                || (isMathFont(oldname) && oldcolor != Color_math)))
                font.setColor(oldcolor);
+#if __cplusplus >= 201402L
        return rc;
+#else
+       /** In theory, this is not needed with C++11, and modern compilers
+        * will complain in C++11 mode, but gcc 4.9 requires this. */
+       return std::move(rc);
+#endif
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to