http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59509
Bug ID: 59509 Summary: template function definition. redefinition error Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ich at az2000 dot de Test case: namespace X { template<typename T> struct Mat{}; template<typename T> struct MatExpr {}; template<typename T> MatExpr<T> prod(Mat<T> const& A, Mat<T> const& B) { return MatExpr<T>(); } }; struct Mat2 {}; template<typename T> X::Mat<T> prod(X::Mat<T> const& A, Mat2 const& B) { return X::Mat<T>(); } template<typename T1, typename T2> auto operator*(const T1& a, const T2& b) -> decltype(X::prod(a, b)) { return X::prod(a, b); } template<typename T1, typename T2> auto operator*(const T1& a, const T2& b) -> decltype(prod(a, b)) { return prod(a, b); } int main() {} I get the error: mathutils.hpp:77:6: error: redefinition of 'template<class T1, class T2> decltype (prod(a, b)) operator*(const T1&, const T2&)' auto operator*(const T1& a, const T2& b) -> decltype(prod(a, b)) { ^ mathutils.hpp:72:6: note: 'template<class T1, class T2> decltype (viennacl::linalg::prod(a, b)) operator*(const T1&, const T2&)' previously declared here auto operator*(const T1& a, const T2& b) -> decltype(viennacl::linalg::prod(a, b)) { ^ It compiles fine with Clang 3.3.