New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1440 - Eigen::Array of void* breaks compilation on VS2015
Summary: Eigen::Array of void* breaks compilation on VS2015
Status: RESOLVED WONTFIX
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
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-20 13:40 UTC by simon.floery
Modified: 2017-06-26 11:15 UTC (History)
3 users (show)



Attachments

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.

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