This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 919 - Compiler error: VC++ 2015 Preview gets EIGEN_WORKAROUND_MSVC_STL_SUPPORT workaround wrong
Summary: Compiler error: VC++ 2015 Preview gets EIGEN_WORKAROUND_MSVC_STL_SUPPORT work...
Status: RESOLVED DUPLICATE of bug 829
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: All Windows
: Normal Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-16 11:23 UTC by Michael Hofmann
Modified: 2019-12-04 13:58 UTC (History)
3 users (show)



Attachments
Sample code that is broken when compiling with VC++ 2015 Preview (1.49 KB, text/plain)
2014-12-16 11:23 UTC, Michael Hofmann
no flags Details

Description Michael Hofmann 2014-12-16 11:23:12 UTC
Created attachment 508 [details]
Sample code that is broken when compiling with VC++ 2015 Preview

I'm trying to compile a piece of code containing a std::vector of Eigen::Vectors using the MS VC++ 2015 Preview compiler, and am both using an Eigen::aligned_allocator<> as well as including the header <Eigen/StdVector> according to the documentation.

Unfortunately, including this header makes my code not compile anymore, due to the inclusion of the EIGEN_WORKAROUND_MSVC_STL_SUPPORT define in <StlSupport/details.h>.

See the attachment for the (self-contained) sample code, adapted (and simplified) from a real codebase for which the part in question compiles fine using GCC (Mac/Linux), Clang (Mac/Linux) and VC++ 2013 with CTP 4.

The compiler error is:
1>test.cpp(43): error C2440: 'static_cast': cannot convert from 'int' to 'division_type'
1>  test.cpp(43): note: No constructor could take the source type, or constructor overload resolution was ambiguous
1>  test.cpp(51): note: see reference to function template instantiation 'Eigen::internal::workaround_msvc_stl_support<T> mean<std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<Eigen::internal::workaround_msvc_stl_support<T>>>>>(Iter,Iter)' being compiled
1>          with
1>          [
1>              T=Eigen::Vector3f
1>  ,            Iter=std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<Eigen::internal::workaround_msvc_stl_support<Eigen::Vector3f>>>>
1>          ]

If I do *not* include <Eigen/StdVector>, then the code compiles fine. This is because EIGEN_WORKAROUND_MSVC_STL_SUPPORT is then not defined as the workaround_msvc_stl_support struct, but as type T directly.

A possible fix would be to change the
  #if EIGEN_COMP_MSVC
line in <StlSupport/details.h> to:
  #if EIGEN_COMP_MSVC < 1900
such that the VC++ 2015 compiler does not make use of the workaround. I doubt that it is still needed.

(Tested with Eigen changeset 2cffd7649eaf.)
Comment 1 Christoph Hertzberg 2014-12-16 12:45:06 UTC
We could simply solve Bug 829. The whole <Eigen/Std*> headers are just a workaround for a bug in C++98/03 which was fixed in C++11. For that it would be good to know the first MSVC version where that part of C++11 is implemented.

*** This bug has been marked as a duplicate of bug 829 ***
Comment 2 Nobody 2019-12-04 13:58:55 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/919.

Note You need to log in before you can comment on or make changes to this bug.