This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 627 - Eigen does not compile with MSVC without language extensions (/Za)
Summary: Eigen does not compile with MSVC without language extensions (/Za)
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: unspecified
Hardware: x86 - 64-bit Windows
: Normal major
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-01 16:45 UTC by Petter
Modified: 2019-12-04 12:27 UTC (History)
4 users (show)



Attachments
Compilation errors (38.54 KB, text/plain)
2013-07-01 17:14 UTC, Petter
no flags Details

Description Petter 2013-07-01 16:45:32 UTC
I cloned the Bitbucket repository and tried to compile the following program in Visual Studio 2013 preview in 64-bit mode:


#include <Eigen/Dense>

int main()
{

}


There were a lot of errors. The first few were:
1>h:\petter\eigen\eigen\src/Core/util/XprHelper.h(388): error C3771: 'CwiseUnaryOp' : friend declaration cannot be found in the nearest namespace scope
1>          h:\petter\eigen\eigen\src/Core/util/XprHelper.h(391) : see reference to class template instantiation 'Eigen::internal::special_scalar_op_base<Derived,Scalar,OtherScalar,true>' being compiled
1>h:\petter\eigen\eigen\src/Core/util/XprHelper.h(388): error C2059: syntax error : '<'
1>h:\petter\eigen\eigen\src/Core/util/XprHelper.h(390): error C2334: unexpected token(s) preceding '{'; skipping apparent function body

There were also a huge number of warnings of the type:
warning C4180: qualifier applied to function type has no meaning; ignored
Comment 1 Petter 2013-07-01 16:46:49 UTC
I should add that I had the same problem in the stable Eigen 3.1.
Comment 2 Gael Guennebaud 2013-07-01 16:55:00 UTC
We don't have MSCV 2013, so could you attach the entire error log.
Comment 3 Gael Guennebaud 2013-07-01 17:00:17 UTC
For the first error, can you try the following fix in file XprHelper.h, line 388:

inline friend const Eigen::CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
  operator*(const OtherScalar& scalar, const Derived& matrix)
  { return static_cast<const special_scalar_op_base&>(matrix).operator*(scalar); }


I simply added Eigen:: to CwiseUnaryOp.
Comment 4 Petter 2013-07-01 17:14:08 UTC
The preview version of MSVC 2013 is free. I am attaching the full error log.
Comment 5 Petter 2013-07-01 17:14:44 UTC
Created attachment 364 [details]
Compilation errors
Comment 6 Christoph Hertzberg 2013-07-01 17:16:28 UTC
I'm not sure if we should make this block 3.2 as long as the compiler is a "preview". 
Does MS have some kind of support page, where you can complain that "MSVS'13 fails to compile things which MSVS'12 does"? Maybe after trying to get a smaller failing example.
Comment 7 Gael Guennebaud 2013-07-01 17:23:19 UTC
oh, it's in a preview stage. so yes, it's not a blocker.
Comment 8 Petter 2013-07-01 22:51:31 UTC
Important information I just discovered trying to reproduce this on my main computer:

The compilation errors only appear when compiling without language extensions (standard mode) with the /Za compiler switch. That switch is not on by default.
Comment 9 Christoph Hertzberg 2013-07-02 10:29:38 UTC
(In reply to comment #8)
> The compilation errors only appear when compiling without language extensions
> (standard mode) with the /Za compiler switch. That switch is not on by default.

Did someone check if disabling language extensions also makes MSVC 2012 and earlier fail? That would contradict our claim to be standard C++98 or MS' claim to fulfill the standard in /Za mode.
Comment 10 Petter 2013-07-02 10:42:37 UTC
For me, it fails in MSVC 2012 as well with the /Za switch. Perhaps the title of this bug should be changed?
Comment 11 Gael Guennebaud 2013-07-02 13:26:24 UTC
ok, so what about my suggestion in comment #3? does it fix the first error? If so fixing the others should be as easy as this one.
Comment 12 Petter 2013-07-02 19:22:05 UTC
Gael, adding Eigen:: fixes that error.

The only errors I get now are Compiler Error C2373. For example, 
error C2373: 'Eigen::DenseBase<Derived>::Constant' : redefinition; different type modifiers
: see declaration of 'Eigen::DenseBase<Derived>::Constant'

http://msdn.microsoft.com/en-us/library/k6z2ykx4(v=vs.71).aspx

Seems related to:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=158
http://forum.kde.org/viewtopic.php?f=74&t=92782
http://forum.kde.org/viewtopic.php?f=74&t=91333
Comment 13 Nobody 2019-12-04 12:27:59 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/627.

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