[LLVMbugs] [Bug 7436] New: Clang fails to select the correct operator delete for access control check

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 21 05:34:50 CDT 2010


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

           Summary: Clang fails to select the correct operator delete for
                    access control check
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Is this even valid C++ code?

% cat t.cc
#include <cstdlib>
#include <new>

struct S {
  void* operator new(std::size_t) throw(std::bad_alloc) {
    return std::malloc(sizeof(S));
  }
  void operator delete(void* p) throw() {
    std::free(p);
  }

 private:
  void* operator new(std::size_t, const std::nothrow_t&) throw();
  void* operator new(std::size_t, void*) throw();
  void* operator new[](std::size_t) throw(std::bad_alloc);
  void* operator new[](std::size_t, const std::nothrow_t&) throw();
  void* operator new[](std::size_t, void*) throw();

  void operator delete(void*, const std::nothrow_t&) throw();
  void operator delete(void*, void*) throw();
  void operator delete[](void* p) throw();
  void operator delete[](void*, const std::nothrow_t&) throw();
  void operator delete[](void*, void*) throw();
};

void test(S* s) { delete s; }

% clang -fsyntax-only t.cc
t.cc:26:19: error: 'operator delete' is a private member of 'S'
void test(S* s) { delete s; }
                  ^
t.cc:19:8: note: declared private here
  void operator delete(void*, const std::nothrow_t&) throw();
       ^
t.cc:26:19: error: 'operator delete' is a private member of 'S'
void test(S* s) { delete s; }
                  ^
t.cc:20:8: note: declared private here
  void operator delete(void*, void*) throw();
       ^
2 errors 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 LLVMbugs mailing list