From c9a343a15c16e60c7c07eae0675ed93bf6a3f9bc Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Mon, 15 Dec 2008 22:21:31 +0000 Subject: [PATCH] idea for bug: Code calls wrong Loki::SmartPtr constructor. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@912 7ec92016-0320-0410-acc4-a06ded1c099a --- test/SmartPtr/SmartPtr.vcproj | 14 +++----- test/SmartPtr/colvin_gibbons_trick.cpp | 46 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/test/SmartPtr/SmartPtr.vcproj b/test/SmartPtr/SmartPtr.vcproj index 48cd79c..9e63a3c 100644 --- a/test/SmartPtr/SmartPtr.vcproj +++ b/test/SmartPtr/SmartPtr.vcproj @@ -1,7 +1,7 @@ + + @@ -169,10 +173,6 @@ /> - - @@ -205,10 +205,6 @@ RelativePath="..\..\include\loki\SmartPtr.h" > - - diff --git a/test/SmartPtr/colvin_gibbons_trick.cpp b/test/SmartPtr/colvin_gibbons_trick.cpp index 72ef935..803f135 100644 --- a/test/SmartPtr/colvin_gibbons_trick.cpp +++ b/test/SmartPtr/colvin_gibbons_trick.cpp @@ -119,3 +119,49 @@ void TryColvinGibbonsTrick( void ) } // ---------------------------------------------------------------------------- + + +#if 0 + +https://sourceforge.net/tracker/index.php?func=detail&aid=2080889&group_id=29557&atid=396644 + +To fix the compile bug we have to disable the (const T&) ctor and use RefToValue, +the way how it is done in auto_prt. + +But I'm not sure about the consequences of such a change. + +Index: loki/SmartPtr.h +=================================================================== +--- loki/SmartPtr.h (revision 910) ++++ loki/SmartPtr.h (working copy) +@@ -1175,6 +1175,7 @@ + GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); + } + ++ /* + template + < + typename T1, +@@ -1187,6 +1188,7 @@ + SmartPtr(const SmartPtr& rhs) + : SP(rhs), OP(rhs), KP(rhs), CP(rhs) + { GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); } ++ */ + + template + < +@@ -1205,7 +1207,10 @@ + + SmartPtr(RefToValue rhs) + : SP(rhs), OP(rhs), KP(rhs), CP(rhs) +- {} ++ { ++ SmartPtr& ref = rhs; ++ GetImplRef(*this) = OP::Clone(GetImplRef(ref)); ++ } + + operator RefToValue() + { return RefToValue(*this); } + +#endif +