Topic: Defect Report: friend operator new/delete namespace scope problem


Author: =?koi8-r?B?5M3J1NLJyiDsycPLwczP1w==?= <limit@tut.by>
Date: Fri, 16 Dec 2005 15:46:38 +0000 (UTC)
Raw View
[ Note: forwarded to C++ committee. -sdc ]

Let consider next valid code example:

class C
{
   public: enum E {};

   friend void* operator new(size_t, E);
   friend void  operator delete(void*, E);
};

void foo()
{
   C::E e;
   C* ptr = new(e) C();
}

After moving class C to any namespace this code became ill-formed
and seems no way to make it valid:

namespace N
{
   class C
   {
      public: enum E {};

      friend void* operator new(size_t, E);
      friend void  operator delete(void*, E);
   };
}

void foo()
{
   N::C::E e;
   N::C* ptr = new(e) N::C();
}

CAUSE:
  Conflict between two clauses in standard
  (ISO/IEC IS 14882:2003, Programming Languages -- C++).