New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1000 - Compilation issue with MSVC 2013 CTP, attempting to reference a deleted function for Block
Summary: Compilation issue with MSVC 2013 CTP, attempting to reference a deleted funct...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.2
Hardware: x86 - general Windows
: Low Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2015-04-20 12:32 UTC by Christos
Modified: 2015-04-26 09:13 UTC (History)
3 users (show)



Attachments

Description Christos 2015-04-20 12:32:21 UTC
Compilation fails for the above code.
Of course this compiles fine when not using the CTP. Not sure if its a compiler bug or an Eigen issue.

Eigen::Matrix3d A;
Eigen::Vector3d b;
Eigen::Vector3d x = A.fullPivLu().solve(b);

Error message is :
1>------ Build started: Project: TestCompilation, Configuration: Debug x64 ------
1>Build started 20/04/2015 10:21:06 PM.
1>InitializeBuildStatus:
1>  Touching "x64\Debug\TestCompilation.tlog\unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  main.cpp
1>c:\src\insight\src\3rdparty\eigen\eigen\src/LU/FullPivLU.h(718): error C2280: 'Eigen::Block<Derived,1,1,false> &Eigen::Block<Derived,1,1,false>::operator =(const Eigen::Block<Derived,1,1,false> &)' : attempting to reference a deleted function
1>          with
1>          [
1>              Derived=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/Core/Block.h(143) : compiler has generated 'Eigen::Block<Derived,1,1,false>::operator =' here
1>          with
1>          [
1>              Derived=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/misc/Solve.h(51) : see reference to function template instantiation 'void Eigen::internal::solve_retval<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Derived>::evalTo<Dest>(Dest &) const' being compiled
1>          with
1>          [
1>              Derived=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/misc/Solve.h(51) : see reference to function template instantiation 'void Eigen::internal::solve_retval<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Derived>::evalTo<Dest>(Dest &) const' being compiled
1>          with
1>          [
1>              Derived=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/Core/ReturnByValue.h(60) : see reference to function template instantiation 'void Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>::evalTo<Dest>(Dest &) const' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/Core/ReturnByValue.h(60) : see reference to function template instantiation 'void Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>::evalTo<Dest>(Dest &) const' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/Core/Matrix.h(296) : see reference to function template instantiation 'void Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>>::evalTo<Eigen::Matrix<double,3,1,0,3,1>>(Dest &) const' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          c:\src\insight\src\3rdparty\eigen\eigen\src/Core/Matrix.h(296) : see reference to function template instantiation 'void Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>>::evalTo<Eigen::Matrix<double,3,1,0,3,1>>(Dest &) const' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>  ,            Dest=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          ..\..\..\Users\Christos\Downloads\TestEigenComp\main.cpp(57) : see reference to function template instantiation 'Eigen::Matrix<double,3,1,0,3,1>::Matrix<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>>(const Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>> &)' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>          ..\..\..\Users\Christos\Downloads\TestEigenComp\main.cpp(57) : see reference to function template instantiation 'Eigen::Matrix<double,3,1,0,3,1>::Matrix<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>>(const Eigen::ReturnByValue<Eigen::internal::solve_retval_base<Eigen::FullPivLU<Eigen::Matrix<double,3,3,0,3,3>>,Rhs>> &)' being compiled
1>          with
1>          [
1>              Rhs=Eigen::Matrix<double,3,1,0,3,1>
1>          ]
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.40
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Comment 1 Christoph Hertzberg 2015-04-20 18:56:00 UTC
I assume you are using 3.2? Can you check if the problem also occurs with the development branch?

Also, can you check if these lines already fail to compile (with either compiler and Eigen version):
    Eigen::Vector3d a1;
    const Eigen::Vector3d a2;
    a1.head<1>()= a2.tail<1>();


If you can't reproduce this on any other compiler, this is very likely a compiler bug. If there is a simple work-around, we can integrate it (if not, we'd unfortunately have to make this a WONTFIX).
Comment 2 Christos 2015-04-21 00:29:27 UTC
Correct, currently using 3.2.4.
The sample code that you provided compiles fine in both compiler versions.

However, the issue persists in development version.

After a bit of searching I was able to find in their blog a link that lists the breaking changes.

The blog
http://blogs.msdn.com/b/vcblog/archive/2013/11/18/announcing-the-visual-c-compiler-november-2013-ctp.aspx

The link to the document, its a .docx
http://aka.ms/I0w822

There is a section there titled "Implicitly declared special member functions".
They made some changes that will mark functions as deleted as required by the C++ standard.

I wonder if this is such a case ?
Comment 3 Gael Guennebaud 2015-04-21 20:22:24 UTC
Indeed, this is probably related to "Implicitly declared special member functions".

In src/Core/util/Macros.h, line 316 we have three different variants of the macro EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR. Currently, in your case it should uses the last version. Could you explicitly try the other ones, especially the one for clang.
Comment 4 Christos 2015-04-21 23:35:05 UTC
The 2nd one generated a different error, while the 3rd compiles fine.
I tested this quickly with the dev version. so not sure if there are any other issues. Will do some more testing later on and report back.
Comment 5 Christoph Hertzberg 2015-04-22 09:56:52 UTC
So fixing this only requires choosing the correct E_I_A_E_O implementation for MSVC?
I wonder, if older MSVC versions have problems with the better (i.e., standard conforming) version? If not, we could simply remove the simple (but wrong) code path:
  using Base::operator=;
Comment 6 Christos 2015-04-22 11:26:09 UTC
I am not sure about all previous versions but it seems that msvc 2013, not the CTP, also compiles fine with the 3rd definition, aka standard conforming.

According to microsoft 
"Previous versions of Visual C++ would define special member functions even if the definition would be ill-formed."

So I would not bet that versions prior to 2013 would work with the 3rd definition.

However, that means that changing the macro to 

#if EIGEN_COMP_MSVC_STRICT && EIGEN_COMP_MSVC < 1800

would work for both msvc 2013 and CTP 2013. 
I would also assume that it would work for CTP 2015.

Hopefully though that does not bring forth other issues.
Comment 7 Christos 2015-04-22 12:05:18 UTC
I should have said that the above change in the macro works fine in the scenarios below :

1)Eigen dev version 
  a) msvc 2013 - OK
  b) msvc 2013 CTP - OK

1) Eigen 3.2.4
  a) msvc 2013 - OK
  b) msvc 2013 CTP - Issue with MapBase which seem to have been resolved in dev version
Comment 8 Christoph Hertzberg 2015-04-23 11:43:04 UTC
Fixed in devel and 3.2 branch (as suggested only for MSVC 2013 and later):
https://bitbucket.org/eigen/eigen/commits/45ad4b2fd2
https://bitbucket.org/eigen/eigen/commits/ad0c042b4d

Regarding the issue with MapBase, please open a new bug.
Comment 9 Christos 2015-04-26 03:07:18 UTC
I see that there is one already related to MapBase and is marked as resolved
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=821
Comment 10 Christoph Hertzberg 2015-04-26 09:13:49 UTC
(In reply to Christos from comment #9)
> I see that there is one already related to MapBase and is marked as resolved
> http://eigen.tuxfamily.org/bz/show_bug.cgi?id=821

That fix should be included in 3.2.4, if that does not fix your problem, please provide an example that fails and re-open that bug.

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