From 21cf4091a9071f5db6d881fabcab7add047af10d Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 22 May 2001 18:58:21 +0000 Subject: [PATCH] Smart pointer and utility changes related to adding checked_delere and checked_array_delete [SVN r10189] --- checked_delete_test.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 checked_delete_test.cpp diff --git a/checked_delete_test.cpp b/checked_delete_test.cpp new file mode 100644 index 0000000..f9107c8 --- /dev/null +++ b/checked_delete_test.cpp @@ -0,0 +1,31 @@ +// Boost checked_delete test program ---------------------------------------// + +// (C) Copyright Beman Dawes 2001. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright +// notice appears in all copies. This software is provided "as is" without +// express or implied warranty, and with no claim as to its suitability for +// any purpose. + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 21 May 01 Initial version (Beman Dawes) + +#include // for checked_delete + +// This program demonstrates compiler errors when trying to delete an +// incomplete type. + +namespace +{ + class Incomplete; +} + +int main() +{ + Incomplete * p; + boost::checked_delete(p); // should cause compile time error + Incomplete ** pa; + boost::checked_array_delete(pa); // should cause compile time error + return 0; +} // main