diff --git a/include/loki/StrongPtr.h b/include/loki/StrongPtr.h index 2de80f8..4a2ddbc 100644 --- a/include/loki/StrongPtr.h +++ b/include/loki/StrongPtr.h @@ -182,6 +182,12 @@ class DeleteSingle public: 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; } @@ -207,6 +213,12 @@ class DeleteArray public: 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; } @@ -1455,6 +1467,10 @@ namespace std #endif // end file guardian // $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 // change init order to inheritance order // diff --git a/test/SmartPtr/strong.cpp b/test/SmartPtr/strong.cpp index 0af1c03..7799b98 100644 --- a/test/SmartPtr/strong.cpp +++ b/test/SmartPtr/strong.cpp @@ -907,13 +907,13 @@ void DoWeakCycleTests( void ) void DoStrongForwardReferenceTest( void ) { /** @note These lines should cause the compiler to make a warning message - about attempting to delete an undefined type. But it should not produce - any error messages. + about attempting to delete an undefined type. They should also cause + an error message about a negative subscript since */ - Thingy_DeleteSingle_ptr p1; - Thingy_DeleteSingle_ptr p2( p1 ); - Thingy_DeleteSingle_ptr p3; - p3 = p1; + //Thingy_DeleteSingle_ptr p1; + //Thingy_DeleteSingle_ptr p2( p1 ); + //Thingy_DeleteSingle_ptr p3; + //p3 = p1; /** @note These lines should cause the compiler to make an error message about attempting to call the destructor for an undefined type. @@ -935,6 +935,10 @@ void DoStrongForwardReferenceTest( void ) // ---------------------------------------------------------------------------- // $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 // - Various makefile improvements (better mingw support, easier to add new sources) // - Include loki/StrongPtr.hpp, not Loki/StrongPtr.hpp (test/SmartPtr)