[LLVMbugs] [Bug 8325] New: Error on throwing pointer to pointee with non public destructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 7 05:21:14 PDT 2010


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

           Summary: Error on throwing pointer to pointee with non public
                    destructor
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: beckmann.maik at googlemail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


When throwing a pointer, clang wants the dtor of the pointee to be public.

class Error {
  virtual ~Error() {}
public:
  // uses decref() and incref() for reference counting
};

void throwing() {
  throw new Error;
}

int main(int argc, char *argv[])
{
  try { throwing(); }
  catch (Error* e) { }
  return 0;
}

// clang++ -o test test.cpp 
// test.cpp:8:9: error: exception object of type 'Error' has private destructor
//   throw new Error;
//         ^
// test.cpp:2:11: note: declared private here
//   virtual ~Error() {}
//           ^
// 1 error generated.




% clang++ --version
clang version 2.8 (branches/release_28)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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