aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unalignedassert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unalignedassert.cpp')
-rw-r--r--test/unalignedassert.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unalignedassert.cpp b/test/unalignedassert.cpp
index 0b5bf0c77..2d0b5a015 100644
--- a/test/unalignedassert.cpp
+++ b/test/unalignedassert.cpp
@@ -61,8 +61,9 @@ struct Good7 : Eigen::WithAlignedOperatorNew
float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects
};
-struct Good8 : Eigen::WithAlignedOperatorNew
+struct Good8
{
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW
float f; // try the f at first -- the EIGEN_ALIGN_128 attribute of m should make that still work
Matrix4f m;
};
@@ -73,6 +74,13 @@ struct Good9
float f;
};
+template<bool Align> struct Depends
+{
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)
+ Vector2d m;
+ float f;
+};
+
template<typename T>
void check_unalignedassert_good()
{
@@ -104,6 +112,8 @@ void unalignedassert()
check_unalignedassert_good<Good7>();
check_unalignedassert_good<Good8>();
check_unalignedassert_good<Good9>();
+ check_unalignedassert_good<Depends<true> >();
+ VERIFY_RAISES_ASSERT(check_unalignedassert_bad<Depends<false> >());
}
void test_unalignedassert()