Vector Class Discussion

Compilation errors with LLVM
Author:  Date: 2014-10-21 19:01

Vectorclass fails to compile due to an ambiguous call to one of two constructors in a few places. First error:

/Users/iljah/libraries/vectorclass/vectorf128.h:224:22: error: ambiguous conversion for functional-style cast from
'const Vec4fb' to 'Vec4ib'
return Vec4fb( ! Vec4ib(a));
/Users/iljah/libraries/vectorclass/vectori128.h:2023:7: note: candidate is the implicit move constructor
class Vec4ib : public Vec4i {
/Users/iljah/libraries/vectorclass/vectori128.h:2023:7: note: candidate is the implicit copy constructor
/Users/iljah/libraries/vectorclass/vectori128.h:2033:5: note: candidate constructor
Vec4ib(__m128i const & x) {

Looking at the code the compiler (Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)) seems right as Vec4i has this constructor:

Vec4i(__m128i const & x) {
xmm = x;

and Vec4ib has the same constructor:

Vec4ib(__m128i const & x) {
xmm = x;

and since 4ib inherits 4i it now has two identical constructors. One answer to this type of situation ( on stackoverflow was "In general - if you have a need to remove inherited constructor, then you probably need to rethink/redesign your class hierarchy." Does 4ib really need to inherit from 4i? Doesn't seem like it would be that much code to duplicate for 4ib to inherit directly from 128b, at least until a better solution is found.

thread Compilation errors with LLVM - Ilja Honkonen - 2014-10-21
last reply Compilation errors with LLVM new - Agner - 2014-10-22