[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Hi
I just stumbled over this issue, may be you have some input on it, but
I'm really thinking I have found a clang bug. Consider the attached code
(I used latest tip of Eigen). It fails to compile with
test.cpp:11:18: error: use of overloaded operator '=' is ambiguous (with
operand types 'typename FixedSegmentReturnType<3>::Type' (aka
'VectorBlock<Eigen::Matrix<float, 4, 1, 0, 4, 1>, 3>') and 'const
ConstantReturnType' (aka 'const
CwiseNullaryOp<internal::scalar_constant_op<Scalar>,
Eigen::Matrix<float, 3, 1, 0, 3, 1> >'))
input.head<3>() = Vector3f::Zero();
~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
test.cpp:17:2: note: in instantiation of function template
specialization 'myFunction<float>' requested here
myFunction<float>();
^
/local/bschindler/projects/eigen/Eigen/src/Core/MatrixBase.h:169:14:
note: candidate function [with OtherDerived =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<float>,
Eigen::Matrix<float, 3, 1, 0, 3, 1> >]
Derived& operator=(const DenseBase<OtherDerived>& other);
^
/local/bschindler/projects/eigen/Eigen/src/Core/MatrixBase.h:172:14:
note: candidate function [with OtherDerived =
Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<float>,
Eigen::Matrix<float, 3, 1, 0, 3, 1> >]
Derived& operator=(const EigenBase<OtherDerived>& other);
Now, If I move lines 10 and 11 into the main function it compiles.
clang bug?
Cheers
Benjamin
#include <Eigen/Core>
using namespace Eigen;
template<typename T>
void myFunction()
{
T someValue = 1.0f;
Vector4f input = Vector4f::Zero();
input.head<3>() = Vector3f::Zero();
}
int main(int, char**)
{
myFunction<float>();
return 0;
}