New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 821 - Compilation problem in MapBase with MSVC 2013/15 CTP with "using Base::Base::operator=;"
Compilation problem in MapBase with MSVC 2013/15 CTP with "using Base::Base::...
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: General
3.2
All Windows
: Lowest Compilation Problem
Assigned To: Nobody
:
: 917 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-04 16:51 UTC by Laurent Chapon
Modified: 2014-12-16 14:00 UTC (History)
6 users (show)



Attachments

Description Laurent Chapon 2014-06-04 16:51:59 UTC
Here is a piece of code that compiled fine with GCC and MSVC 2013.

#include <Eigen/Geometry> 

int main()
{ 
Eigen::Transform<double, 3, Eigen::Affine> hom;
Eigen::Quaterniond temp;
hom.linear()=temp.toRotationMatrix();
return 0;
}

However, when updating to the recent toolset: MSVC November 2013 CTP, which we need since it provides partial support for C++11 features such as constexpr, the compiler produces an error in MapBase.h line 237: using Base::Base::operator=;

error C3083: '{ctor}': the symbol to the left of a '::' must be a type. 

Has anyone encountered this or related problems? 

Thanks
Comment 1 Christoph Hertzberg 2014-06-04 17:41:19 UTC
Appears more like a compiler bug (as I understand it, CTP is a preview release?)

Does it work if you replace
  using Base::Base::operator=;
by
  typedef typename Base::Base Base_MSVC_Workaround;
  using Base_MSVC_Workaround::operator=;
?
Comment 2 Laurent Chapon 2014-06-05 10:20:39 UTC
(In reply to comment #1)
> Appears more like a compiler bug (as I understand it, CTP is a preview
> release?)

Yes CTP is a preview release. This is likely a compiler bug indeed. I just wondered whether anyone in the Eigen community had experienced it also. 

> 
> Does it work if you replace
>   using Base::Base::operator=;
> by
>   typedef typename Base::Base Base_MSVC_Workaround;
>   using Base_MSVC_Workaround::operator=;
> ?
This doesn't work either,here is the error: 

1>c:\program files\eigen\include\eigen3\eigen\src/Core/MapBase.h(237): error C2146: syntax error : missing ';' before identifier 'Base_MSVC_Workaround'
1>          c:\program files\eigen\include\eigen3\eigen\src/Core/MapBase.h(241) : see reference to class template instantiation 'Eigen::MapBase<Derived,1>' being compiled
1>c:\program files\eigen\include\eigen3\eigen\src/Core/MapBase.h(237): fatal error C1903: unable to recover from previous error(s); stopping compilation
Comment 3 Laurent Chapon 2014-06-05 10:24:38 UTC
Very weird, 
this works though: 


typedef Base Base1;
typedef typename Base1::Base Base_MSVC_Workaround;
using Base_MSVC_Workaround::operator=;
Comment 4 Christoph Hertzberg 2014-06-05 12:15:52 UTC
(In reply to comment #2)
> Yes CTP is a preview release. This is likely a compiler bug indeed. I just
> wondered whether anyone in the Eigen community had experienced it also. 

Very few people read new bug entries. If you want broader feedback, send to the mailing list.


(In reply to comment #3)
> typedef Base Base1;
> typedef typename Base1::Base Base_MSVC_Workaround;
> using Base_MSVC_Workaround::operator=;

Can you save the second typedef then? I.e.
  typedef Base Base_;
  using Base_::Base::operator=;

Not sure, if we should push that workaround to our main repository. It's not really intrusive, but it will have very limited use.
Do you have any experience how long MS takes until the next release? And is there a way to inform them about compiler bugs?
Comment 5 Laurent Chapon 2014-06-05 13:13:05 UTC
Hi Christoph, thanks. 
Yes of course you can save the second typename .

I have no broad experience with MS, I develop on Linux, and only check occasionally that my projects compile Under MSVC. 

I will submit the bug to MSVC. 

Thanks once again for your prompt support. Eigen is really great !
Comment 6 Christoph Hertzberg 2014-06-06 14:18:29 UTC
Can you post a link to MSVC's bug entry if available?

As long as the compiler itself is in experimental stage, I propose you (and other possible users) only add this workaround locally. Should the bug recur in an official (supported) compiler release, we can add this workaround.
Therefore, I'm closing this bug for now.
Comment 7 patrikhuber 2014-11-16 15:00:53 UTC
I'm not sure I got Eigen 3.2.1 or 3.2.2, but this bug still seems to be present, or present again, in the VS 2015 Preview. This means it will most likely get into release :/ Would be nice to see the bug report to MS.
Comment 8 Christoph Hertzberg 2014-11-16 17:59:07 UTC
If you can't find the bug report, or nobody actually submitted one, just report a new one -- the MSVC guys should be able to identify duplicates.
Does the workaround still work?
Also, are you able to generate compilation errors with more minimal examples? E.g., just a class with a base class typedef-ed as Base, which itself has a base class typedef-ed as Base together with a using directive.
Comment 9 Christoph Hertzberg 2014-12-12 18:11:09 UTC
*** Bug 917 has been marked as a duplicate of this bug. ***
Comment 10 Gael Guennebaud 2014-12-13 21:36:47 UTC
I'd be ok to push the workaround. That will save us time in arguing.
Comment 11 Christoph Hertzberg 2014-12-13 21:55:54 UTC
Actually, would a simple using Base::operator=; be sufficient (as suggested in Bug 917 comment 0)?
I would prefer that over a typedef Base Base_; workaround
Comment 12 Gael Guennebaud 2014-12-16 13:38:23 UTC
This would work thanks to another compiler issue (ICC11 this time). See comments in the diff for the details.

https://bitbucket.org/eigen/eigen/commits/79a32d90365d/
https://bitbucket.org/eigen/eigen/commits/ccf109e3b393/
Comment 13 Michael Hofmann 2014-12-16 14:00:15 UTC
Base::operator=; is sufficient.

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