From b56348046ffae0328314094686c79b5a5be45aa8 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 11 Aug 2013 17:52:43 +0200 Subject: [PATCH] Ref<> objects must be nested by reference because they potentially store a temporary object (transplanted from 6719e56b5bfe9ae4badc9a6e894c5824f663d62e ) --- Eigen/src/Core/Ref.h | 5 +++-- test/ref.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Core/Ref.h b/Eigen/src/Core/Ref.h index aba795bdb..00d9e6d2b 100644 --- a/Eigen/src/Core/Ref.h +++ b/Eigen/src/Core/Ref.h @@ -94,7 +94,8 @@ struct traits > typedef _PlainObjectType PlainObjectType; typedef _StrideType StrideType; enum { - Options = _Options + Options = _Options, + Flags = traits >::Flags | NestByRefBit }; template struct match { @@ -111,7 +112,7 @@ struct traits > }; typedef typename internal::conditional::type type; }; - + }; template diff --git a/test/ref.cpp b/test/ref.cpp index 65b4f5a3e..f639d900b 100644 --- a/test/ref.cpp +++ b/test/ref.cpp @@ -14,9 +14,9 @@ static int nb_temporaries; -inline void on_temporary_creation(int size) { +inline void on_temporary_creation(int) { // here's a great place to set a breakpoint when debugging failures in this test! - if(size!=0) nb_temporaries++; + nb_temporaries++; }