Clang Errors on Linux (Operator Ambiguity; Narrowing Issues)
Closed this issue · 4 comments
aleneum commented
This seems to be resolved fine on OSX but not on Linux using clang. See build log:
/home/travis/build/iclcv/icl/ICLUtils/src/ICLUtils/SSETypes.h:2285:19: error: use of overloaded operator '/' is ambiguous (with operand types 'icl::utils::icl128i32s' and 'icl::utils::icl128i32s')
tmp = tmp / icl128i32s(3) + icl128i32s(709921077);
~~~ ^ ~~~~~~~~~~~~~
/home/travis/build/iclcv/icl/ICLUtils/src/ICLUtils/SSETypes.h:1652:21: note: candidate function
inline icl128 operator/(const icl128 &lv, const icl128 &rv) {
^
/home/travis/build/iclcv/icl/ICLUtils/src/ICLUtils/SSETypes.h:2285:19: note: built-in candidate operator/(__attribute__((__vector_size__(2 * sizeof(long long)))) long long, __attribute__((__vector_size__(2 * sizeof(long long)))) long long)
tmp = tmp / icl128i32s(3) + icl128i32s(709921077);
This blocks #7. Any ideas?
celbrech commented
My idea would be to just not define the operator manually if there is a built-in version.
i.e. if we're on clang (or using a mac), we don't define
/home/travis/build/iclcv/icl/ICLUtils/src/ICLUtils/SSETypes.h:1652:21: note: candidate function
inline icl128 operator/(const icl128 &lv, const icl128 &rv) {
rhaschke commented
The respective code reads:
#ifndef ICL_SYSTEM_APPLE
inline icl128 operator/(const icl128 &lv, const icl128 &rv) {
icl128 ret = lv;
return ret /= rv;
}
#endif
Probably, the guard needs to be replaced by #ifndef __clang__
aleneum commented
I stumbled upon an OpenCV issue with c++11 and narrowing. Currently, the presented solution is to deactivate analytics with -Wno-narrowing
. Should I go ahead and add this to our CMakeLists when clang is used?