From: Gabe Black Date: Mon, 3 Jan 2011 20:31:20 +0000 (-0500) Subject: RefCount: Fix reference counting pointer == and != with a T* on the left. X-Git-Tag: stable_2012_02_02~686 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a10ccc5e551857fc3a7c049df99547ccfe3f72b;p=gem5.git RefCount: Fix reference counting pointer == and != with a T* on the left. These operators were expecting a const T& instead of a const T*, and were not being picked up and used by gcc in the right places as a result. Apparently no one used these operators before. A unit test which exposed these problems, verified the solution, and checks other basic functionality is on the way. --- diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh index 64224ca7f..b73183a1a 100644 --- a/src/base/refcnt.hh +++ b/src/base/refcnt.hh @@ -109,7 +109,7 @@ bool operator==(const RefCountingPtr &l, const T *r) { return l.get() == r; } template -bool operator==(const T &l, const RefCountingPtr &r) +bool operator==(const T *l, const RefCountingPtr &r) { return l == r.get(); } template @@ -121,7 +121,7 @@ bool operator!=(const RefCountingPtr &l, const T *r) { return l.get() != r; } template -bool operator!=(const T &l, const RefCountingPtr &r) +bool operator!=(const T *l, const RefCountingPtr &r) { return l != r.get(); } #endif // __BASE_REFCNT_HH__