diff --git a/include/armadillo_bits/unwrap.hpp b/include/armadillo_bits/unwrap.hpp index 0026afd0..6f9fe076 100644 --- a/include/armadillo_bits/unwrap.hpp +++ b/include/armadillo_bits/unwrap.hpp @@ -396,7 +396,7 @@ struct quasi_unwrap< subview_row > static constexpr bool has_orig_mem = false; // NOTE: set to false as this is the general case; original memory is only used when the subview is a contiguous chunk template - arma_inline bool is_alias(const Mat& X) const { return (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && ((sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false); } }; @@ -1441,7 +1441,7 @@ struct partial_unwrap< subview_row > constexpr eT get_val() const { return eT(1); } template - arma_inline bool is_alias(const Mat& X) const { return (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::yes) && ((sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false); } static constexpr bool do_trans = false; static constexpr bool do_times = false;