diff options
-rw-r--r-- | config_host/config_global.h.in | 4 | ||||
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | drawinglayer/source/animation/animationtiming.cxx | 10 |
3 files changed, 35 insertions, 0 deletions
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in index 2bb60ca656ac..375e610a1180 100644 --- a/config_host/config_global.h.in +++ b/config_host/config_global.h.in @@ -26,4 +26,8 @@ Any change in this header will cause a rebuild of almost everything. /* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */ #define HAVE_CPP_GUARANTEED_COPY_ELISION 0 +/* Fix for <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579> "Return by converting + move constructor": */ +#define HAVE_CXX_CWG1579_FIX 0 + #endif diff --git a/configure.ac b/configure.ac index 4a2d71a04877..4ab159b4146a 100644 --- a/configure.ac +++ b/configure.ac @@ -6438,6 +6438,27 @@ CXXFLAGS=$save_CXXFLAGS AC_LANG_POP([C++]) AC_SUBST([HAVE_CPP_GUARANTEED_COPY_ELISION]) +HAVE_CXX_CWG1579_FIX= +AC_MSG_CHECKING([whether $CXX has a fix for CWG1579]) +AC_LANG_PUSH([C++]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include <memory> + struct S1 {}; + struct S2: S1 {}; + std::unique_ptr<S1> f() { + std::unique_ptr<S2> s2(new S2); + return s2; + } + ])], [ + AC_DEFINE([HAVE_CXX_CWG1579_FIX],[1]) + AC_MSG_RESULT([yes]) + ], [AC_MSG_RESULT([no])]) +CXXFLAGS=$save_CXXFLAGS +AC_LANG_POP([C++]) +AC_SUBST([HAVE_CXX_CWG1579_FIX]) + dnl =================================================================== dnl system stl sanity tests dnl =================================================================== diff --git a/drawinglayer/source/animation/animationtiming.cxx b/drawinglayer/source/animation/animationtiming.cxx index db629aa8d31f..374def8aed6e 100644 --- a/drawinglayer/source/animation/animationtiming.cxx +++ b/drawinglayer/source/animation/animationtiming.cxx @@ -18,6 +18,8 @@ */ #include <memory> + +#include <config_global.h> #include <drawinglayer/animation/animationtiming.hxx> #include <basegfx/numeric/ftools.hxx> #include <o3tl/make_unique.hxx> @@ -190,7 +192,11 @@ namespace drawinglayer pNew->append(*i); } +#if HAVE_CXX_CWG1579_FIX + return pNew; +#else return std::move(pNew); +#endif } bool AnimationEntryList::operator==(const AnimationEntry& rCandidate) const @@ -283,7 +289,11 @@ namespace drawinglayer pNew->append(*i); } +#if HAVE_CXX_CWG1579_FIX + return pNew; +#else return std::move(pNew); +#endif } bool AnimationEntryLoop::operator==(const AnimationEntry& rCandidate) const |