last-svn-commit-735-g89e985d Fix a serious bug with gcc 4.5 and later.

* mln/value/equiv.hh: Return values by copy. --- milena/ChangeLog | 8 +++++++- milena/mln/value/equiv.hh | 15 ++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 0fb0b2b..76cf550 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,9 @@ +2011-01-20 Guillaume Lazzara <z@lrde.epita.fr> + + Fix a serious bug with gcc 4.5 and later. + + * mln/value/equiv.hh: Return values by copy. + 2010-11-29 Roland Levillain <roland@lrde.epita.fr> Work around g++ 4.5 deficiencies to compile Milena. @@ -24,7 +30,7 @@ * mln/core/site_set/p_complex_piter.hh, * mln/core/site_set/p_n_faces_piter.hh: - Here. + Here. 2010-11-29 Roland Levillain <roland@lrde.epita.fr> diff --git a/milena/mln/value/equiv.hh b/milena/mln/value/equiv.hh index 06919bd..23512ab 100644 --- a/milena/mln/value/equiv.hh +++ b/milena/mln/value/equiv.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -29,6 +30,10 @@ /*! \file * * \brief The mln::equiv routine. + * + * Since g++ 4.5.x the returned value is returned by copy. If returned + * by reference the result was incorrect and the value lifetime was + * not extended correctly to other functions. */ # include <mln/core/concept/value.hh> @@ -78,13 +83,13 @@ namespace mln // Fwd decl. template <typename V> - const typename internal::equiv_<V>::ret& + typename internal::equiv_<V>::ret run_equiv_(const V& v); template <typename V, typename T> inline - const typename internal::equiv_<V>::ret& + typename internal::equiv_<V>::ret run_equiv_(const Value<V>* v, const T*) { return run_equiv_(exact(v)->to_equiv()); // Rec. @@ -92,7 +97,7 @@ namespace mln template <typename V> inline - const V& + V run_equiv_(const void*, const V* v) { return *v; // Stop rec. @@ -100,7 +105,7 @@ namespace mln template <typename V> inline - const typename internal::equiv_<V>::ret& + typename internal::equiv_<V>::ret run_equiv_(const V& v) { return run_equiv_(&v, &v); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara