Skip to content

gfor example doesn't work #1028

@vakopian

Description

@vakopian

According to the documentation (http://www.arrayfire.com/docs/page_gfor.htm#gfor_iterator) the gfor iterator can be used in expressions:

    int m = 2, n = 3;
    array A = constant(1,n,n,m);
    array B = constant(1,n,n);
    gfor (seq k, m) {
        A(span,span,k) = (k+1)*B + sin(k+1);  // expressions
    }

This example does not compile with g++ nor with clang. They both complain about

use of overloaded operator '+' is ambiguous

If I change k+1 to k+1.0 to avoid the ambiguity (i.e. force a double), the program compiles, but fails at runtime:

C++ exception with description "ArrayFire Exception(203): Invalid input size
In "arrayfire/src/api/cpp/array.cpp:926" thrown in the test body.

ArrayFire version is 3.1.0.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions