[arrayfire] 277/408: Create instances for const index member functions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 3121ca1ab40ce73658d74ac65d5d5f0cdc71a167
Author: Umar Arshad <umar at arrayfire.com>
Date:   Tue Aug 18 14:04:34 2015 -0400

    Create instances for const index member functions
---
 src/api/cpp/array.cpp | 19 +++++++++++++------
 test/array.cpp        | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/api/cpp/array.cpp b/src/api/cpp/array.cpp
index 15fdfd2..22dacc9 100644
--- a/src/api/cpp/array.cpp
+++ b/src/api/cpp/array.cpp
@@ -739,12 +739,19 @@ namespace af
     }
 
     //FIXME: Check if this leaks
-#define MEM_INDEX(FUNC_SIG, USAGE)          \
-    array::array_proxy                      \
-    array::array_proxy::FUNC_SIG            \
-    {                                       \
-        array *out = new array(this->get());\
-        return out->USAGE;                  \
+#define MEM_INDEX(FUNC_SIG, USAGE)                  \
+    array::array_proxy                              \
+    array::array_proxy::FUNC_SIG                    \
+    {                                               \
+        array *out = new array(this->get());        \
+        return out->USAGE;                          \
+    }                                               \
+                                                    \
+    const array::array_proxy                        \
+    array::array_proxy::FUNC_SIG const              \
+    {                                               \
+        const array *out = new array(this->get());  \
+        return out->USAGE;                          \
     }
 
     MEM_INDEX(row(int index)                , row(index));
diff --git a/test/array.cpp b/test/array.cpp
index 0b7f288..682bc5b 100644
--- a/test/array.cpp
+++ b/test/array.cpp
@@ -373,3 +373,19 @@ TEST(Array, ShapeAttributes)
     EXPECT_FALSE(volume.    iscolumn());
     EXPECT_FALSE(hypercube. iscolumn());
 }
+
+TEST(Array, ISSUE_951)
+{
+// This works
+    //const af::array a(100, 100);
+    //af::array b = a.cols(0, 20);
+    //b = b.rows(10, 20);
+
+// This works
+    //af::array a(100, 100);
+    //af::array b = a.cols(0, 20).rows(10, 20);
+
+// This fails with linking error
+    const af::array a = randu(100, 100);
+    af::array b = a.cols(0, 20).rows(10, 20);
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list