From 409231d214ebfce847d6242cee587ab7f9f72f85 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jul 2018 21:25:08 +0200 Subject: [PATCH] express: make WeakPointerTo cast operators explicit This prevents accidentally (and unsafely) decaying a WeakPointerTo to a regular pointer. --- panda/src/express/weakPointerTo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/express/weakPointerTo.h b/panda/src/express/weakPointerTo.h index 5834113b7a..2e8c6029a5 100644 --- a/panda/src/express/weakPointerTo.h +++ b/panda/src/express/weakPointerTo.h @@ -38,7 +38,7 @@ public: INLINE To &operator *() const; INLINE To *operator -> () const; // MSVC.NET 2005 insists that we use T *, and not To *, here. - INLINE operator T *() const; + INLINE explicit operator T *() const; PUBLISHED: INLINE PointerTo lock() const; @@ -75,7 +75,7 @@ PUBLISHED: public: INLINE const To &operator *() const; INLINE const To *operator -> () const; - INLINE operator const T *() const; + INLINE explicit operator const T *() const; PUBLISHED: INLINE ConstPointerTo lock() const;