Re: [eigen] latest default changeset (e8aee247f42a) causes compiler error on MSC

[ Thread Index | Date Index | More Archives ]


thank you for the notice. Could you confirm that the attached patch works for you?



On Sat, Nov 29, 2014 at 5:44 PM, Eamon Nerbonne <eamon@xxxxxxxxxxxx> wrote:
Hi all,

Two of my Eigen-using programs currently fail to compile on MSC (Visual Studio 2013 update 4) with the following message:

1>c:\vcs\external\eigen\eigen\src/Core/Diagonal.h(225): error C2373: 'Eigen::MatrixBase<Derived>::diagonal' : redefinition; different type modifiers
1>          c:\vcs\external\eigen\eigen\src/Core/MatrixBase.h(254) : see declaration of 'Eigen::MatrixBase<Derived>::diagonal'

The error does not occur on 31d2b16f5ef1, but does on the changeset immediately thereafter (e8aee247f42a: Simplify return type of diagonal(Index) (and ease compiler job)).

--eamon@xxxxxxxxxxxx - Tel#:+31-6-15142163

diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h
--- a/Eigen/src/Core/Diagonal.h
+++ b/Eigen/src/Core/Diagonal.h
@@ -208,25 +208,25 @@ MatrixBase<Derived>::diagonal() const
   * Example: \include MatrixBase_diagonal_int.cpp
   * Output: \verbinclude MatrixBase_diagonal_int.out
   * \sa MatrixBase::diagonal(), class Diagonal */
 template<typename Derived>
 inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType
 MatrixBase<Derived>::diagonal(Index index)
-  return typename DiagonalIndexReturnType<DynamicIndex>::Type(derived(), index);
+  return DiagonalDynamicIndexReturnType(derived(), index);
 /** This is the const version of diagonal(Index). */
 template<typename Derived>
 inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType
 MatrixBase<Derived>::diagonal(Index index) const
-  return typename ConstDiagonalIndexReturnType<DynamicIndex>::Type(derived(), index);
+  return ConstDiagonalDynamicIndexReturnType(derived(), index);
 /** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this
   * \c *this is not required to be square.
   * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0
   * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal.
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -241,17 +241,17 @@ template<typename Derived> class MatrixB
     typename DiagonalIndexReturnType<Index>::Type diagonal();
     template<int Index>
     typename ConstDiagonalIndexReturnType<Index>::Type diagonal() const;
     typedef Diagonal<Derived,DynamicIndex> DiagonalDynamicIndexReturnType;
-    typedef const Diagonal<const Derived,DynamicIndex> ConstDiagonalDynamicIndexReturnType;
+    typedef typename internal::add_const<Diagonal<const Derived,DynamicIndex> >::type ConstDiagonalDynamicIndexReturnType;
     DiagonalDynamicIndexReturnType diagonal(Index index);
     ConstDiagonalDynamicIndexReturnType diagonal(Index index) const;
     template<unsigned int Mode> struct TriangularViewReturnType { typedef TriangularView<Derived, Mode> Type; };
     template<unsigned int Mode> struct ConstTriangularViewReturnType { typedef const TriangularView<const Derived, Mode> Type; };

Mail converted by MHonArc 2.6.19+