i have a file named SharedCount.hxx.
i this file i have a class that ovveride operator new.

problem with this is when i want to use this class compiler generate this error

error C2059: syntax error : 'constant'

and error line point to operator new overloading.

exactly this file is modified version of boost shared_ptr.i use these file in another projects without any problem(vs c++ 2010).

please help me to solve this error.
unfortunately original code is very very long to be posted here but if it is required i will post it compeletly
*******************************************SharedCount.hxx Snippet****************************************************

#include "stdafx.h"
#include <memory>           // std::auto_ptr, std::allocator
#include <functional>       // std::less
#include <exception>        // std::exception
#include <new>              // std::bad_alloc
#include <typeinfo>         // std::type_info in get_deleter
#include <cstddef>          // std::size_t
#include "ILock.hxx"
#include "ILMutex.hxx"
template<class P, class D> class ICORE_API sp_counted_base_impl: public sp_counted_base

   P ptr; // copy constructor must not throw
   D del; // copy constructor must not throw

   sp_counted_base_impl(sp_counted_base_impl const &);
   sp_counted_base_impl & operator= (sp_counted_base_impl const &);

   typedef sp_counted_base_impl<P, D> this_type;


   // pre: initial_use_count <= initial_weak_count, d(p) must not throw
   sp_counted_base_impl(P p, D d): ptr(p), del(d)

   virtual void dispose() // nothrow

   virtual void * get_deleter(std::type_info const & ti)
      return ti == typeid(D)? &del: 0;

   void * operator new(size_t)
      return std::allocator<this_type>().allocate(1, static_cast<this_type *>(0));

   void operator delete(void * p)
      std::allocator<this_type>().deallocate(static_cast<this_type *>(p), 1);


Have you tried implementing the new/delete functions out-of-line (not in the header file, but in the .cc/.cpp file? This may be an issue with some compilers.