forked from OSchip/llvm-project
PR8325: don't do destructor checking when a pointer is thrown.
llvm-svn: 116336
This commit is contained in:
parent
8ac477ffb5
commit
36ebbec121
|
@ -509,6 +509,10 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
|
|||
// exception handling will make use of the vtable.
|
||||
MarkVTableUsed(ThrowLoc, RD);
|
||||
|
||||
// If a pointer is thrown, the referenced object will not be destroyed.
|
||||
if (isPointer)
|
||||
return false;
|
||||
|
||||
// If the class has a non-trivial destructor, we must be able to call it.
|
||||
if (RD->hasTrivialDestructor())
|
||||
return false;
|
||||
|
|
|
@ -450,3 +450,11 @@ namespace test18 {
|
|||
A<int> member;
|
||||
};
|
||||
}
|
||||
|
||||
// PR8325
|
||||
namespace test19 {
|
||||
class A { ~A(); };
|
||||
// The destructor is not implicitly referenced here. Contrast to test16,
|
||||
// testing PR7281, earlier in this file.
|
||||
void b(A* x) { throw x; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue