Changed DeleteSingle and DeleteArray policy to not allow use of incomplete
types. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@640 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
cdc9205e8e
commit
5a1e25a204
2 changed files with 26 additions and 6 deletions
|
@ -182,6 +182,12 @@ class DeleteSingle
|
||||||
public:
|
public:
|
||||||
inline static void Delete( const P * p )
|
inline static void Delete( const P * p )
|
||||||
{
|
{
|
||||||
|
/** @note If you see an error message about a negative subscript, that
|
||||||
|
means your are attempting to use Loki to delete an incomplete type.
|
||||||
|
Please don't use this policy with incomplete types; you may want to
|
||||||
|
use DeleteNothing instead.
|
||||||
|
*/
|
||||||
|
typedef char Type_Must_Be_Defined[ sizeof(P) ? 1 : -1 ];
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +213,12 @@ class DeleteArray
|
||||||
public:
|
public:
|
||||||
inline static void Delete( const P * p )
|
inline static void Delete( const P * p )
|
||||||
{
|
{
|
||||||
|
/** @note If you see an error message about a negative subscript, that
|
||||||
|
means your are attempting to use Loki to delete an incomplete type.
|
||||||
|
Please don't use this policy with incomplete types; you may want to
|
||||||
|
use DeleteNothing instead.
|
||||||
|
*/
|
||||||
|
typedef char Type_Must_Be_Defined[ sizeof(P) ? 1 : -1 ];
|
||||||
delete [] p;
|
delete [] p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,6 +1467,10 @@ namespace std
|
||||||
#endif // end file guardian
|
#endif // end file guardian
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 2006/04/19 01:04:26 rich_sposato
|
||||||
|
// Changed DeleteSingle and DeleteArray policy to not allow use of incomplete
|
||||||
|
// types.
|
||||||
|
//
|
||||||
// Revision 1.4 2006/04/16 14:08:46 syntheticpp
|
// Revision 1.4 2006/04/16 14:08:46 syntheticpp
|
||||||
// change init order to inheritance order
|
// change init order to inheritance order
|
||||||
//
|
//
|
||||||
|
|
|
@ -907,13 +907,13 @@ void DoWeakCycleTests( void )
|
||||||
void DoStrongForwardReferenceTest( void )
|
void DoStrongForwardReferenceTest( void )
|
||||||
{
|
{
|
||||||
/** @note These lines should cause the compiler to make a warning message
|
/** @note These lines should cause the compiler to make a warning message
|
||||||
about attempting to delete an undefined type. But it should not produce
|
about attempting to delete an undefined type. They should also cause
|
||||||
any error messages.
|
an error message about a negative subscript since
|
||||||
*/
|
*/
|
||||||
Thingy_DeleteSingle_ptr p1;
|
//Thingy_DeleteSingle_ptr p1;
|
||||||
Thingy_DeleteSingle_ptr p2( p1 );
|
//Thingy_DeleteSingle_ptr p2( p1 );
|
||||||
Thingy_DeleteSingle_ptr p3;
|
//Thingy_DeleteSingle_ptr p3;
|
||||||
p3 = p1;
|
//p3 = p1;
|
||||||
|
|
||||||
/** @note These lines should cause the compiler to make an error message
|
/** @note These lines should cause the compiler to make an error message
|
||||||
about attempting to call the destructor for an undefined type.
|
about attempting to call the destructor for an undefined type.
|
||||||
|
@ -935,6 +935,10 @@ void DoStrongForwardReferenceTest( void )
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.5 2006/04/19 01:04:25 rich_sposato
|
||||||
|
// Changed DeleteSingle and DeleteArray policy to not allow use of incomplete
|
||||||
|
// types.
|
||||||
|
//
|
||||||
// Revision 1.4 2006/04/18 07:29:41 lfittl
|
// Revision 1.4 2006/04/18 07:29:41 lfittl
|
||||||
// - Various makefile improvements (better mingw support, easier to add new sources)
|
// - Various makefile improvements (better mingw support, easier to add new sources)
|
||||||
// - Include loki/StrongPtr.hpp, not Loki/StrongPtr.hpp (test/SmartPtr)
|
// - Include loki/StrongPtr.hpp, not Loki/StrongPtr.hpp (test/SmartPtr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue