Missing constructor: dist_object<T>::dist_object(T , team)
Issue #185
resolved
The spec for dist_object calls for two forms of basic constructor:
template <typename T>
dist_object <T>::dist_object(T value, team &team = world());
template <typename T>
template <typename ...Arg>
dist_object <T>::dist_object(team &team, Arg &&...arg);
I believe this implies that for T = basic type, the team and value arguments may appear in either order. Ie:
#include <upcxx/upcxx.hpp>
int main() {
upcxx::team &tm = upcxx::world();
upcxx::dist_object<int> dobj1(47, tm);
upcxx::dist_object<int> dobj2(tm, 47);
return 0;
}
However currently the first, simpler form appears to be missing an implementation:
$ upcxx -g distobj.cc
distobj.cc: In function 'int main()':
distobj.cc:5:39: error: no matching function for call to 'upcxx::dist_object<int>::dist_object(int, upcxx::team&)'
upcxx::dist_object<int> dobj1(47, tm);
^
In file included from /usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/upcxx.hpp:13:0,
from distobj.cc:1:
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:110:5: note: candidate: upcxx::dist_object<T>::dist_object(upcxx::dist_object<T>&&) [with T = int]
dist_object(dist_object &&that):
^
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:110:5: note: candidate expects 1 argument, 2 provided
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:104:5: note: candidate: upcxx::dist_object<T>::dist_object(T) [with T = int]
dist_object(T value):
^
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:104:5: note: candidate expects 1 argument, 2 provided
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:91:5: note: candidate: upcxx::dist_object<T>::dist_object(upcxx::team&, T) [with T = int]
dist_object(upcxx::team &tm, T value):
^
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:91:5: note: no known conversion for argument 1 from 'int' to 'upcxx::team&'
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:78:5: note: candidate: template<class ... U> upcxx::dist_object<T>::dist_object(upcxx::team&, U&& ...)
dist_object(upcxx::team &tm, U &&...arg):
^
/usr/local/upcxx-2018.9.3/upcxx.debug.gasnet_seq.smp/include/upcxx/dist_object.hpp:78:5: note: template argument deduction/substitution failed:
distobj.cc:5:39: note: cannot convert '47' (type 'int') to type 'upcxx::team&'
upcxx::dist_object<int> dobj1(47, tm);
^
IMO we should fix the dist_object constructor overloads to match the spec, ie add the missing overload.
Comments (2)
-
reporter -
reporter - changed status to resolved
issue 185: Fix argument order for dist_object constructor to match spec
Resolves issue
#185→ <<cset 77d4f1756bce>>
- Log in to comment
see pull request #65