Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2003-07-15 14:12:08


On Tue, 15 Jul 2003 10:58:10 +0200, Daniel Frey wrote:

> Also, it seems possible to create a work-around for boost. I'll post a
> patch for discussion soon :)

Here's the patch, applying the work-around for all versions of the Intel
compiler. Of course we should restrict this once we find out which
versions are affected and when the bug is fixed by Intel.

To explain the bug a bit: When you create a small test case, you'll
probably get the error from the compiler you are looking for. If you put
the checked_delete in it's own header, it still works as long as you
include the header with

#include "my_header.h"

but if you use

#include <my_header.h>

and compile it with -I. then the compiler magically accepts
sizeof(Incomplete) with no warnings or errors and returns 0 as the size.
To work around this, I added a simple STATIC_ASSERT which - for some
reason - still works :)

Regards, Daniel

--- checked_delete.hpp.orig Tue Jul 15 20:45:09 2003
+++ checked_delete.hpp Tue Jul 15 21:00:34 2003
@@ -10,6 +10,7 @@
 //
 // Copyright (c) 1999, 2000, 2001, 2002 boost.org
 // Copyright (c) 2002, 2003 Peter Dimov
+// Copyright (c) 2003 Daniel Frey
 //
 // Permission to copy, use, modify, sell and distribute this software
 // is granted provided this copyright notice appears in all copies.
@@ -19,6 +20,11 @@
 // See http://www.boost.org/libs/utility/checked_delete.html for documentation.
 //
 
+#include <boost/config.hpp>
+#if defined(BOOST_INTEL)
+#include <boost/static_assert.hpp>
+#endif
+
 namespace boost
 {
 
@@ -27,12 +33,18 @@
 template<class T> inline void checked_delete(T * x)
 {
     typedef char type_must_be_complete[sizeof(T)];
+#if defined(BOOST_INTEL)
+ BOOST_STATIC_ASSERT(sizeof(type_must_be_complete)!=0);
+#endif
     delete x;
 }
 
 template<class T> inline void checked_array_delete(T * x)
 {
     typedef char type_must_be_complete[sizeof(T)];
+#if defined(BOOST_INTEL)
+ BOOST_STATIC_ASSERT(sizeof(type_must_be_complete)!=0);
+#endif
     delete [] x;
 }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk