Boost logo

Boost :

From: Trevor Perrin (tperrin_at_[hidden])
Date: 2001-03-02 16:53:07


A couple questions about the workaround:

 - what does "deletion with std::nothrow" mean?

 - also, if I add only the non-array delete:

  inline void operator delete(const void* p) throw() {operator
  delete(const_cast<void*>(p));}

  but then do:

  const int* y = new int[10];
  delete[] y;

  the non-array version above still gets called (if I add the array version
as well then it gets called appropriately); I believe it's okay to delete
arrays with the non-array version in VC (so the above I think works), but it
still seems incorrect function resolution.

  Anyways, if there's a procedure for submitting bugs/workarounds please
point me at it (you mentioned a VC Known Bug page, which I'd be very
interested in seeing!); thanks.

-----Original Message-----
From: Ed Brey [mailto:brey_at_[hidden]]
Sent: Friday, March 02, 2001 1:13 PM
To: boost_at_[hidden]
Subject: Re: [boost] RE: unable to use shared_ptr<const int> on VC6

From: "Trevor Perrin" <tperrin_at_[hidden]>
> const int* x = new int;
> (A) delete x;
> (B) delete const_cast<remove_const<const int*>::type>(x);
>
> But they both give:
> error C2665: 'delete' : none of the 2 overloads can convert parameter 1
from
> type 'const int *'
>
> Am I doing something wrong or is my compiler hosed? If the latter, are
> there any other potential workarounds?

Compiler is hosed. A workaround is to include this line in your handy-dandy
VC6 workaround header:
inline void operator delete(const void* p) throw() {operator
delete(const_cast<void*>(p));}

It would probably be a good thing to add this bug and workaround to the VC
known bug page, since it does affect significantly affect
Boost.SmartPointer. Also, to be more complete, one would add similar
workaround lines for deletion of const arrays, plus deletion with
std::nothrow.

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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