You declare the operators =operator= as returning a clr_scoped_ptr%clr_scoped_ptr%, but there's no return statement in their body. This gives me compilation errors. I supposedsuppose the implementation should be:
clr_scoped_ptr% operator=( T* ptr ) { reset(ptr); return (clr_scoped_ptr%)this; }
template<typename U>
clr_scoped_ptr% operator=( U ptr ) { reset(ptr); return (clr_scoped_ptr%)this; }