From d1d0d6b788b2f9d8aaa7f0caa49fc4ed3612242c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 16 Jul 2003 10:53:06 +0000 Subject: [PATCH] Fixed Intel 7 issue (reported by Daniel Frey) [SVN r19145] --- checked_delete_test.cpp | 5 ++--- include/boost/checked_delete.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/checked_delete_test.cpp b/checked_delete_test.cpp index 161b49f..f5c799e 100644 --- a/checked_delete_test.cpp +++ b/checked_delete_test.cpp @@ -23,9 +23,8 @@ namespace int main() { - Incomplete * p; + Incomplete * p = 0; boost::checked_delete(p); // should cause compile time error - Incomplete ** pa; - boost::checked_array_delete(pa); // should cause compile time error + boost::checked_array_delete(p); // should cause compile time error return 0; } // main diff --git a/include/boost/checked_delete.hpp b/include/boost/checked_delete.hpp index f2300dd..3f7ca47 100644 --- a/include/boost/checked_delete.hpp +++ b/include/boost/checked_delete.hpp @@ -26,13 +26,14 @@ namespace boost template inline void checked_delete(T * x) { - typedef char type_must_be_complete[sizeof(T)]; + // Intel 7 accepts sizeof(incomplete) as 0 in system headers + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; delete x; } template inline void checked_array_delete(T * x) { - typedef char type_must_be_complete[sizeof(T)]; + typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; delete [] x; } @@ -43,6 +44,7 @@ template struct checked_deleter void operator()(T * x) const { + // boost:: disables ADL boost::checked_delete(x); } };