aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/geo_quaternion.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2017-08-22 15:10:42 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2017-08-22 15:10:42 +0200
commitbc91a2df8b9f1c5fa47bfeb9b03c2036890570b5 (patch)
tree17830dcd82d143f15d8aaad4f3b1df0eb5de2930 /test/geo_quaternion.cpp
parentfc39d5954b72ca2307921beb8a784cd78c2a8d10 (diff)
bug #1461: fix compilation of Map<const Quaternion>::x()
Diffstat (limited to 'test/geo_quaternion.cpp')
-rw-r--r--test/geo_quaternion.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp
index 96889e722..8ee8fdb27 100644
--- a/test/geo_quaternion.cpp
+++ b/test/geo_quaternion.cpp
@@ -231,6 +231,19 @@ template<typename Scalar> void mapQuaternion(void){
VERIFY_IS_APPROX(mq3*mq2, q3*q2);
VERIFY_IS_APPROX(mcq1*mq2, q1*q2);
VERIFY_IS_APPROX(mcq3*mq2, q3*q2);
+
+ // Bug 1461, compilation issue with Map<const Quat>::w(), and other reference/constness checks:
+ VERIFY_IS_APPROX(mcq3.coeffs().x() + mcq3.coeffs().y() + mcq3.coeffs().z() + mcq3.coeffs().w(), mcq3.coeffs().sum());
+ VERIFY_IS_APPROX(mcq3.x() + mcq3.y() + mcq3.z() + mcq3.w(), mcq3.coeffs().sum());
+ mq3.w() = 1;
+ const Quaternionx& cq3(q3);
+ VERIFY( &cq3.x() == &q3.x() );
+ const MQuaternionUA& cmq3(mq3);
+ VERIFY( &cmq3.x() == &mq3.x() );
+ // FIXME the following should be ok. The problem is that currently the LValueBit flag
+ // is used to determine wether we can return a coeff by reference or not, which is not enough for Map<const ...>.
+ //const MCQuaternionUA& cmcq3(mcq3);
+ //VERIFY( &cmcq3.x() == &mcq3.x() );
}
template<typename Scalar> void quaternionAlignment(void){