aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-10-12 20:32:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-10-12 20:32:36 +0000
commit98efb9f6df133f5508d260c4510c6c3bd70f34ad (patch)
tree6539bf0414156ade03cffcc9c4875ebff6b8795a /lib
parentdf41f18936693f7c62e457eefb9fad5b2d2fe3cd (diff)
PR8325: don't do destructor checking when a pointer is thrown.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExprCXX.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index e193cafbc2..04c15e3f00 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -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;