New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1440 - Eigen::Array of void* breaks compilation on VS2015
Summary: Eigen::Array of void* breaks compilation on VS2015
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - expression templates (show other bugs)
Version: 3.3 (current stable)
Hardware: All Windows
: Normal Compilation Problem
Assignee: Nobody
Depends on:
Reported: 2017-06-20 13:40 UTC by simon.floery
Modified: 2017-06-26 11:15 UTC (History)
3 users (show)


Description simon.floery 2017-06-20 13:40:21 UTC

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:, 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):

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