|Summary:||Eigen::Array of void* breaks compilation on VS2015|
|Component:||Core - expression templates||Assignee:||Nobody <eigen.nobody>|
|Severity:||Compilation Problem||CC:||chtz, gael.guennebaud, jacob.benoit.1|
|Version:||3.3 (current stable)|
Description simon.floery 2017-06-20 13:40:21 UTC
Hi, 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> with 1> [ 1> T=Eigen::Matrix<double,3,1,0,3,1>, 1> PromotedType=void * 1> ] 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. best, Simon
Comment 1 Gael Guennebaud 2017-06-23 12:25:56 UTC
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.
Comment 2 simon.floery 2017-06-26 11:15:45 UTC
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.
Comment 3 Nobody 2019-12-04 17:03:46 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/1440.