[LLVMbugs] [Bug 7346] New: operator delete not seen in derived class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 10 11:43:41 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7346

           Summary: operator delete not seen in derived class
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: John.Thompson.JTSoftware at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5004)
 --> (http://llvm.org/bugs/attachment.cgi?id=5004)
The code.

In the following, the derived class has a static void operator delete(void
*pPtr) member, but it doesn't seem to be seen.  The base class does not have
it.  Or do overloads need to match the base class?

Code:

class object
{
public:
 static void * operator new(unsigned int numBytes, unsigned int memPurpose,
unsigned int alignment);
 static void operator delete(void *pPtr, unsigned int memPurpose, unsigned int
alignment);
 static void * operator new[](unsigned int numBytes, unsigned int memPurpose,
unsigned int alignment);
 static void operator delete[](void *pPtr, unsigned int memPurpose, unsigned
int alignment);
 inline static void * operator new(unsigned int numBytes, void *pPlacement) {
(void)&numBytes; return pPlacement; }
 inline static void operator delete(void *pPtr, void *pPlacement) {
(void)&pPtr; (void)&pPlacement; }
public:
 object();
 ~object();
 unsigned int m_checkValue;
 unsigned int m_classID;
};

class media : public object
{
protected:
 media(const char *pPrimaryIdentifier);
public:
 virtual ~media();
 static void * operator new(unsigned int numBytes);
 static void operator delete(void *pPtr);
 static void * operator new[](unsigned int numBytes);
 static void operator delete[](void *pPtr);
 static void * operator new(unsigned int numBytes, unsigned int memPurpose) ;
 static void operator delete(void *pPtr, unsigned int memPurpose);
 static void * operator new[](unsigned int numBytes, unsigned int memPurpose);
 static void operator delete[](void *pPtr, unsigned int memPurpose);
 static void * operator new(unsigned int numBytes, void *pPlacement);
 static void operator delete(void *pPtr, void *pPlacement);
};

Output:

C:\Sony\Clang\exp>clang -cc1 delete1.cpp
delete1.cpp:22:10: error: no suitable member 'operator delete' in 'media'
 virtual ~media();
         ^
delete1.cpp:5:14: note: member 'operator delete' declared here
 static void operator delete(void *pPtr, unsigned int memPurpose, unsigned int
alignment);
             ^
delete1.cpp:9:21: note: member 'operator delete' declared here
 inline static void operator delete(void *pPtr, void *pPlacement) {
(void)&pPtr; (void)&pPlacement; }
                    ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list