The following code
Eigen::Array< void*, 64, 1 > handles; // Reason for compilation failure
Eigen::Matrix< double, 3, 1 > p0(1, 2, 3);
Eigen::Matrix< double, 3, 1 > p1(3, 2, 1);
Eigen::Matrix< double, 3, 1 > e = p0 - p1; // Compilation fails here
fails to compile the last line with MSVC2015 Update 3 and eigen versions 3.3.3 and 3.3.4, while it works with eigen 3.2.8. gcc is fine with either version of eigen. Commenting the first line makes the problem disappear, using Eigen::Array< int*, ...> as well. The compiler reports as follows:
3.3.4\eigen\src\core\util\meta.h(137): error C2182: 'abstract declarator': illegal use of type 'void'
1> eigen-3.3.4\eigen\src\core\util\meta.h(156): note: see reference to class template instantiation 'Eigen::internal::is_convertible_impl<Eigen::Matrix<double,3,1,0,3,1>,void>' being compiled
1> eigen-3.3.4\eigen\src\core\util\xprhelper.h(64): note: see reference to class template instantiation 'Eigen::internal::is_convertible<T,PromotedType>' being compiled
1> PromotedType=void *
1> eigentester\eigentester\main.cpp(13): note: see reference to class template instantiation 'Eigen::internal::promote_scalar_arg<void *,Eigen::Matrix<double,3,1,0,3,1>,false>' being compiled
I'm aware that an Eigen::Array< void*, ... > is not a major use case. However, as the expression failing to compile has no obvious link to the source of the problem, I wanted to have this documented in case someone else is running into this.
It's not the first time I see MSVC screwing up because of the sole presence of an unrelated piece of code. It's really scary. This should be reported to MSVC developers.
I've added it there: http://eigen.tuxfamily.org/index.php?title=FAQ#Compilation, mentioning that std::array is better suited for that purpose.
Out of curiosity, we reported this as bug against latest VS2017 (where the problem occurs as well): https://developercommunity.visualstudio.com/content/problem/72956/unrelated-code-fails-compilation.html.
-- 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/1440.