boostorg / boostorg/compute

Binding custom function fails to compile if function has more than three arguments

Open
#838 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

For instance adding the following to test/test_functional_bind.cpp causes a compiler error:
```
BOOST_AUTO_TEST_CASE(bind_more_than_four)
{
int data[] = { 1, 2, 3, 4 };
compute::vector vector(data, data + 4, queue);

BOOST_COMPUTE_FUNCTION(int, add_four_nums,
(int first, int second, int third, int fourth),
{
return first + second + third + fourth;
});

compute::transform(
vector.begin(), vector.end(), vector.begin(),
compute::bind(add_four_nums, _1, 2, 3, 4),
queue
);
}
```
The full error and build log can be found here: https://pastebin.com/MnHi2WZs. I am using ubuntu 18.04 with libboost1.65-dev and g++ 7.4. This reproduces for a variety of different argument types etc.

As far as I know, the best work around is to adapt a struct which contains to arguments.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.