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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to