From 436c65ba2129f9e4aad2b4258351a0381a7b0bac Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 6 Feb 2013 11:58:20 +0100 Subject: Fix compilation with Clang on MacOS. Apparently Clang does not like methods to be declared static inline, and then have their definition somewhere else. Error messages: ../../../include/QtCore/../../src/corelib/tools/qpoint.h:156:37: error: conflicting types for 'dotProduct' Q_DECL_CONSTEXPR inline int QPoint::dotProduct(const QPoint &p1, const QPoint &p2) ^ ../../../include/QtCore/../../src/corelib/tools/qpoint.h:77:40: note: previous declaration is here Q_DECL_CONSTEXPR static inline int dotProduct(const QPoint &p1, const QPoint &p2); ^ ../../../include/QtCore/../../src/corelib/tools/qpoint.h:338:40: error: conflicting types for 'dotProduct' Q_DECL_CONSTEXPR inline qreal QPointF::dotProduct(const QPointF &p1, const QPointF &p2) ^ ../../../include/QtCore/../../src/corelib/tools/qpoint.h:239:42: note: previous declaration is here Q_DECL_CONSTEXPR static inline qreal dotProduct(const QPointF &p1, const QPointF &p2); ^ Change-Id: I041b96d79506d2898daf40d70b37f02459de35bd Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/tools/qpoint.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/corelib/tools/qpoint.h') diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 4e0f4d5a4e..69403ebc53 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -74,7 +74,8 @@ public: inline QPoint &operator/=(qreal divisor); - Q_DECL_CONSTEXPR static inline int dotProduct(const QPoint &p1, const QPoint &p2); + Q_DECL_CONSTEXPR static inline int dotProduct(const QPoint &p1, const QPoint &p2) + { return p1.xp * p2.xp + p1.yp * p2.yp; } friend Q_DECL_CONSTEXPR inline bool operator==(const QPoint &, const QPoint &); friend Q_DECL_CONSTEXPR inline bool operator!=(const QPoint &, const QPoint &); @@ -153,9 +154,6 @@ inline QPoint &QPoint::operator*=(double factor) inline QPoint &QPoint::operator*=(int factor) { xp = xp*factor; yp = yp*factor; return *this; } -Q_DECL_CONSTEXPR inline int QPoint::dotProduct(const QPoint &p1, const QPoint &p2) -{ return p1.xp * p2.xp + p1.yp * p2.yp; } - Q_DECL_CONSTEXPR inline bool operator==(const QPoint &p1, const QPoint &p2) { return p1.xp == p2.xp && p1.yp == p2.yp; } @@ -236,7 +234,8 @@ public: inline QPointF &operator*=(qreal c); inline QPointF &operator/=(qreal c); - Q_DECL_CONSTEXPR static inline qreal dotProduct(const QPointF &p1, const QPointF &p2); + Q_DECL_CONSTEXPR static inline qreal dotProduct(const QPointF &p1, const QPointF &p2) + { return p1.xp * p2.xp + p1.yp * p2.yp; } friend Q_DECL_CONSTEXPR inline bool operator==(const QPointF &, const QPointF &); friend Q_DECL_CONSTEXPR inline bool operator!=(const QPointF &, const QPointF &); @@ -335,11 +334,6 @@ inline QPointF &QPointF::operator*=(qreal c) xp*=c; yp*=c; return *this; } -Q_DECL_CONSTEXPR inline qreal QPointF::dotProduct(const QPointF &p1, const QPointF &p2) -{ - return p1.xp * p2.xp + p1.yp * p2.yp; -} - Q_DECL_CONSTEXPR inline bool operator==(const QPointF &p1, const QPointF &p2) { return qFuzzyIsNull(p1.xp - p2.xp) && qFuzzyIsNull(p1.yp - p2.yp); -- cgit v1.2.3