$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: pps (i-love-spam_at_[hidden])
Date: 2005-03-28 20:48:15
Dan Bikel wrote:
> Rather disturbingly, the following code compiles (at least, with 
> g++-3.3.2):
> 
>   #include "boost/shared_ptr.hpp"
>   using namespace boost;
>   class X {};
>   int main() {
>     const shared_ptr<X> y;
>     delete y;
>   }
> 
> Normally, when you compile code with delete applied to a non-pointer 
> type, you get a compile-time error.  What's going on here?
try this:
struct X {
        operator X*(){ return this; }
        void operator delete (void *p){}
};
int main(int, char*[]) {
        X x;
        delete x;
}
> 
> TIA,
> Dan.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://listarchives.boost.org/mailman/listinfo.cgi/boost-users
>