aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/ctorleak.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ctorleak.cpp')
-rw-r--r--test/ctorleak.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/test/ctorleak.cpp b/test/ctorleak.cpp
index 73904176b..e76a4a7ba 100644
--- a/test/ctorleak.cpp
+++ b/test/ctorleak.cpp
@@ -10,7 +10,7 @@ struct Foo
Foo() : dummy(0)
{
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
// TODO: Is this the correct way to handle this?
if (Foo::object_count > Foo::object_limit) { std::cout << "\nThrow!\n"; throw Foo::Fail(); }
#endif
@@ -46,10 +46,7 @@ EIGEN_DECLARE_TEST(ctorleak)
MatrixX r(rows, cols);
Foo::object_limit = r.size()+internal::random<Index>(0, rows*cols - 2);
std::cout << "object_limit =" << Foo::object_limit << std::endl;
-#ifdef EIGEN_EXCEPTIONS
- try
- {
-#endif
+ EIGEN_TRY {
if(internal::random<bool>()) {
std::cout << "\nMatrixX m(" << rows << ", " << cols << ");\n";
MatrixX m(rows, cols);
@@ -58,12 +55,12 @@ EIGEN_DECLARE_TEST(ctorleak)
std::cout << "\nMatrixX m(r);\n";
MatrixX m(r);
}
-#ifdef EIGEN_EXCEPTIONS
+#if EIGEN_USE_EXCEPTIONS
VERIFY(false); // not reached if exceptions are enabled
- }
- catch (const Foo::Fail&) { /* ignore */ }
#endif
}
+ EIGEN_CATCH(const Foo::Fail&) { /* ignore */ }
+ }
VERIFY_IS_EQUAL(Index(0), Foo::object_count);
{