Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic function allow implicit conversion of update argument #1571

Closed
crtrott opened this issue Apr 18, 2018 · 2 comments
Closed

Atomic function allow implicit conversion of update argument #1571

crtrott opened this issue Apr 18, 2018 · 2 comments
Assignees
Labels
Enhancement Improve existing capability; will potentially require voting
Milestone

Comments

@crtrott
Copy link
Member

crtrott commented Apr 18, 2018

Most backends allow a call like this to happen:

long* ptr = ...
atomic_fetch_add(ptr,2);

This is enabled by an explicit available overload of:

void atomic_fetch_add(long* ptr, const long val);

For some backends (like Serial only) we only have this function:

template<class T>
void atomic_fetch_add(T* ptr, const T val);

This will fail to match since the template deduction is ambiguous, it could either be long or int.
To make this match we could do the following:

template<class T>
void atomic_fetch_add(T* ptr, typename std::add_const<T>::type& val);

Now only the first parameter is used for the actual deduction of T and val follows matching rules which include implicit conversions.

@crtrott crtrott added the Enhancement Improve existing capability; will potentially require voting label Apr 18, 2018
@crtrott
Copy link
Member Author

crtrott commented Apr 18, 2018

I am fixing one of those cases for Serial, since I can't get FENL to compile otherwise.

@crtrott crtrott self-assigned this Apr 18, 2018
@ibaned ibaned added this to the 2018 July milestone Aug 1, 2018
@ibaned
Copy link
Contributor

ibaned commented Aug 1, 2018

@crtrott I think you managed to fix all of these?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improve existing capability; will potentially require voting
Projects
None yet
Development

No branches or pull requests

2 participants