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
This commit is contained in:
syntheticpp 2008-12-15 22:21:31 +00:00
parent 2d68004ddf
commit c9a343a15c
2 changed files with 51 additions and 9 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="SmartPtr"
ProjectGUID="{D7AB4FEF-E7AF-443D-93A5-37F323F2042D}"
RootNamespace="SmartPtr"
@ -157,6 +157,10 @@
RelativePath=".\base.h"
>
</File>
<File
RelativePath=".\colvin_gibbons_trick.cpp"
>
</File>
<File
RelativePath=".\LockTest.cpp"
>
@ -169,10 +173,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath="..\..\src\SafeFormat.cpp"
>
@ -205,10 +205,6 @@
RelativePath="..\..\include\loki\SmartPtr.h"
>
</File>
<File
RelativePath=".\strong.cpp"
>
</File>
<File
RelativePath="..\..\src\StrongPtr.cpp"
>

View file

@ -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<T1, OP1, CP1, KP1, SP1, CNP1 >& rhs)
: SP(rhs), OP(rhs), KP(rhs), CP(rhs)
{ GetImplRef(*this) = OP::Clone(GetImplRef(rhs)); }
+ */
template
<
@@ -1205,7 +1207,10 @@
SmartPtr(RefToValue<SmartPtr> rhs)
: SP(rhs), OP(rhs), KP(rhs), CP(rhs)
- {}
+ {
+ SmartPtr& ref = rhs;
+ GetImplRef(*this) = OP::Clone(GetImplRef(ref));
+ }
operator RefToValue<SmartPtr>()
{ return RefToValue<SmartPtr>(*this); }
#endif