[cfe-commits] r116336 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/CXX/class.access/p4.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Oct 12 13:32:36 PDT 2010
Author: efriedma
Date: Tue Oct 12 15:32:36 2010
New Revision: 116336
URL: http://llvm.org/viewvc/llvm-project?rev=116336&view=rev
Log:
PR8325: don't do destructor checking when a pointer is thrown.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/CXX/class.access/p4.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=116336&r1=116335&r2=116336&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Oct 12 15:32:36 2010
@@ -509,6 +509,10 @@
// 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;
Modified: cfe/trunk/test/CXX/class.access/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/p4.cpp?rev=116336&r1=116335&r2=116336&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/p4.cpp (original)
+++ cfe/trunk/test/CXX/class.access/p4.cpp Tue Oct 12 15:32:36 2010
@@ -450,3 +450,11 @@
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; }
+}
More information about the cfe-commits
mailing list