Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update operators to use results of expressions as the return type.
configure detects the presence of decltype, typeof, __typeof__ or boost to facilitate this, and falls back on a simple implementation for obvious numeric types if none of these are present. The type deduction has to go via classes such as: template<class L, class R> struct AddType { typedef TOON_TYPEOF((L()+R())) type; }; Because using constructs such as: // Addition Vector + Vector template<int Size, typename P1, typename P2, typename B1, typename B2> Vector<Size, TOON_TYPEOF(P1()+P2())> operator+(const Vector<Size, P1, B1>& v1, const Vector<Size, P2, B2>& v2) { typedef TOON_TYPEOF(P1()+P2()) restype; return Vector<Size,restype>(v1, v2, Operator<Internal::Add<restype> >()); } causes the following error: TooN/test/test2.cc:15: sorry, unimplemented: mangling typeof, use decltype instead or TooN/test/test2.cc:15: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI or TooN/test/test2.cc:16: internal compiler error: in write_type, at cp/mangle.c:1649 Please submit a full bug report, with preprocessed source if appropriate.
- Loading branch information